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); - }; + } }