#[cfg(feature = "nonlinear-jacobian-check")]
mod checker;
mod error;
#[cfg(feature = "nonlinear-expert")]
mod expert;
#[cfg(any(
feature = "nonlinear-expert",
feature = "nonlinear-jacobian-check",
feature = "least-squares-nonlinear-expert",
feature = "least-squares-covariance"
))]
mod jacobian;
#[cfg(feature = "nonlinear-easy")]
mod solver;
#[cfg(feature = "nonlinear-systems")]
mod systems;
#[cfg(feature = "nonlinear-jacobian-check")]
pub use checker::{JacobianCheckError, JacobianCheckResult, check_jacobian, check_jacobian_f32};
pub use error::NonlinearError;
#[cfg(feature = "nonlinear-expert")]
pub use expert::{
ExpertNonlinearOptions, ExpertNonlinearResult, JacobianStructure, VariableScaling,
solve_system_expert, solve_system_expert_f32, solve_system_with_jacobian,
solve_system_with_jacobian_f32,
};
#[cfg(any(
feature = "nonlinear-expert",
feature = "nonlinear-jacobian-check",
feature = "least-squares-nonlinear-expert",
feature = "least-squares-covariance"
))]
pub use jacobian::{JacobianIndexError, JacobianMut};
#[cfg(feature = "nonlinear-easy")]
pub use solver::{solve_system, solve_system_f32};
#[cfg(feature = "nonlinear-systems")]
pub use systems::{
SystemOptions, SystemReport, SystemTermination, solve_scalar_equations,
solve_scalar_equations_f32,
};
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct NonlinearOptions<T = f64> {
pub tolerance: T,
}
impl Default for NonlinearOptions<f64> {
fn default() -> Self {
Self { tolerance: 1.0e-10 }
}
}
impl NonlinearOptions<f32> {
pub const fn single_precision() -> Self {
Self { tolerance: 1.0e-5 }
}
}
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum NonlinearStatus {
Converged,
MaximumFunctionEvaluations,
ToleranceTooSmall,
SlowProgress,
SlowProgressJacobianEvaluations,
SlowProgressIterations,
}
#[derive(Clone, Debug, PartialEq)]
pub struct NonlinearResult<T = f64> {
pub solution: alloc::vec::Vec<T>,
pub residual: alloc::vec::Vec<T>,
pub residual_norm: T,
pub function_evaluations: usize,
pub status: NonlinearStatus,
}