diff --git a/src/lib.rs b/src/lib.rs index 1b0508b..2b60cf2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -69,7 +69,10 @@ impl OptimizationProblem { { let mut y_iter = result.y.iter().map(|&y| y as f64); let f = array::from_fn(|i| { - let y = vec![y_iter.next().unwrap(); self.molecules[i].structure_variables().len()]; + let y: Vec<_> = y_iter + .by_ref() + .take(self.molecules[i].structure_variables().len()) + .collect(); self.molecules[i].evaluate_feature_variables(&y) }); let p = self.property_model.evaluate_parameter_variables(&f);