From 70742fad8b7dfd539a3813117bbca5b117a128bc Mon Sep 17 00:00:00 2001 From: Andrew Golovashevich Date: Sun, 8 Feb 2026 19:30:58 +0300 Subject: [PATCH] [lab4] Simplified to procedures on f64 --- lab4/src/algo/compute.rs | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lab4/src/algo/compute.rs b/lab4/src/algo/compute.rs index a66abc9..17b1c7e 100644 --- a/lab4/src/algo/compute.rs +++ b/lab4/src/algo/compute.rs @@ -3,15 +3,11 @@ fn compute_potential( input_data: &[f64; Is], potential_data: &mut [f64; Is], output_data: &mut [f64; Is], - f: impl Fn(f64) -> f64 + f: impl Fn(f64) -> f64, ) { for (i, n) in weights.iter().enumerate() { - let P = input_data - .iter() - .zip(n) - .map(|(x, w)| x.apply_weight(*w)) - .sum(); + let P = input_data.iter().zip(n).map(|(x, w)| x * w).sum(); potential_data[i] = P; output_data[i] = f(P); - }; + } }