From 4dd662e53d04ae24f733faee1b93a0f2b494be83 Mon Sep 17 00:00:00 2001 From: Ed Younis Date: Mon, 5 Aug 2024 12:57:27 -0400 Subject: [PATCH] Added num_residuals to python interface --- src/python/minimizers/residual_fn.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/python/minimizers/residual_fn.rs b/src/python/minimizers/residual_fn.rs index 6b1b2c4..261630c 100644 --- a/src/python/minimizers/residual_fn.rs +++ b/src/python/minimizers/residual_fn.rs @@ -143,6 +143,10 @@ impl PyHilberSchmidtResidualFn { self.cost_fn.get_residuals(¶ms) } + pub fn num_residuals(&self, _py: Python) -> usize { + self.cost_fn.num_residuals() + } + pub fn get_grad(&self, py: Python, params: Vec) -> Py> { PyArray2::from_array(py, &self.cost_fn.get_grad(¶ms)).to_owned() }