1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
//! Newton's method trait for systems of nonlinear equations. use crate::DType; use crate::optimize::roots::{RootOptions, RootTensorResult}; use numr::error::Result; use numr::runtime::Runtime; use numr::tensor::Tensor; /// Newton's method for systems of nonlinear equations. /// /// Uses finite differences to approximate the Jacobian. pub trait NewtonSystemAlgorithms<R: Runtime<DType = DType>> { /// Solve F(x) = 0 using Newton's method. /// /// # Arguments /// * `f` - The function F: R^n -> R^n /// * `x0` - Initial guess /// * `options` - Solver options fn newton_system<F>( &self, f: F, x0: &Tensor<R>, options: &RootOptions, ) -> Result<RootTensorResult<R>> where F: Fn(&Tensor<R>) -> Result<Tensor<R>>; }