diff --git a/py-tuutal/src/first_order.rs b/py-tuutal/src/first_order.rs index cf0e297..69619df 100644 --- a/py-tuutal/src/first_order.rs +++ b/py-tuutal/src/first_order.rs @@ -22,11 +22,11 @@ macro_rules! first_order_method { wrap_vec_func_scalar!(py, f, f_kwargs), wrap_vec_func_vec!(py, g, g_kwargs), &x0.as_array().to_owned(), - &DescentParameter::$name(gamma, beta), + DescentParameter::$name(gamma, beta), gtol, maxiter, ) { - Ok(value) => Ok(value.into_pyarray_bound(py)), + Ok((x, _fx)) => Ok(x.into_pyarray_bound(py)), Err(error) => match error { TuutalError::Convergence { iterate: x, diff --git a/py-tuutal/src/zero_order.rs b/py-tuutal/src/zero_order.rs index 150874d..145afed 100644 --- a/py-tuutal/src/zero_order.rs +++ b/py-tuutal/src/zero_order.rs @@ -33,7 +33,7 @@ pub fn nelder_mead<'py>( adaptive.unwrap_or(false), bounds, ) { - Ok(value) => Ok(value.into_pyarray_bound(py)), + Ok((x, _fx)) => Ok(x.into_pyarray_bound(py)), Err(error) => match error { // Maybe better to throw also the current iterate and the number // actual function calls for this exception. @@ -142,7 +142,7 @@ pub fn brent_unbounded( kwargs: Option<&Bound<'_, PyDict>>, ) -> PyResult<(f64, f64, usize)> { let func = wrap_scalar_func_scalar!(py, f, kwargs); - let brack = brack.map_or(None, |v| Some([v.0, v.1])); + let brack = brack.map(|v| [v.0, v.1]); match if let Some(val) = brack { brent_unbounded_rs(func, Some(&[val[0], val[1]]), maxiter, xtol) } else {