Skip to main content

Module math

Module math 

Source
Expand description

Layer 1g — mathematical special functions (inverse error function, incomplete gamma functions and their inverse). Special mathematical functions used by the thermophysics and statistics kernels.

Ports the OpenFOAM primitives/functions/Math helpers: the inverse error function (erf_inv), the regularised lower/upper incomplete gamma functions and their unnormalised forms (inc_gamma_ratio_p, inc_gamma_ratio_q, inc_gamma_p, inc_gamma_q), and the inverse of the regularised lower incomplete gamma (inv_inc_gamma). All arguments and results are dimensionless f64. It also hosts parallel, the batched root finders — bisection, Brent, bracket-safeguarded Newton, and batched closed-form polynomial roots — each dispatched across crate::compute::ComputeBackend. They live here rather than under polynomial/ because the general case solves a caller-supplied residual such as h(T) - h_target, which is not a polynomial at all, and because this module is already where the crate’s iterative inversions live.

Re-exports§

pub use differentiate::derivative;
pub use differentiate::derivative_backend_for;
pub use differentiate::derivative_batch;
pub use differentiate::jacobian;
pub use differentiate::jacobian_batch;
pub use differentiate::jacobian_batch_backend_for;
pub use differentiate::jacobian_column_backend_for;
pub use differentiate::ode_system_jacobian;
pub use differentiate::DerivativeBatch;
pub use differentiate::DerivativeSolution;
pub use differentiate::DiffBatchFailure;
pub use differentiate::DiffScheme;
pub use differentiate::DiffSettings;
pub use differentiate::DiffStatus;
pub use differentiate::JacobianBatch;
pub use differentiate::JacobianSolution;
pub use differentiate::NumericalJacobian;
pub use differentiate::CBRT_EPSILON;
pub use differentiate::DERIVATIVE_BATCH_MIN_POINTS;
pub use differentiate::FIFTH_ROOT_EPSILON;
pub use differentiate::JACOBIAN_BATCH_MIN_PROBLEMS;
pub use differentiate::JACOBIAN_COLUMN_MIN_DIMENSION;
pub use erf_inv::erf_inv;
pub use inc_gamma::inc_gamma_p;
pub use inc_gamma::inc_gamma_q;
pub use inc_gamma::inc_gamma_ratio_p;
pub use inc_gamma::inc_gamma_ratio_q;
pub use inv_inc_gamma::inv_inc_gamma;
pub use minimise::golden_section_batch;
pub use minimise::minimise_backend_for;
pub use minimise::MinBatch;
pub use minimise::MinBatchFailure;
pub use minimise::MinProblem;
pub use minimise::MinSettings;
pub use minimise::MinSolution;
pub use minimise::MinStatus;
pub use minimise::Sense;
pub use minimise::GOLDEN_RATIO;
pub use minimise::MINIMISE_BATCH_MIN_PROBLEMS;
pub use minimise::SQRT_EPSILON;
pub use parallel::cubic_roots_batch;
pub use parallel::linear_roots_batch;
pub use parallel::poly_roots_backend_for;
pub use parallel::quadratic_roots_batch;
pub use parallel::root_batch_backend_for;
pub use parallel::solve_bracketed_batch;
pub use parallel::solve_newton_batch;
pub use parallel::RootBatch;
pub use parallel::RootBatchFailure;
pub use parallel::RootMethod;
pub use parallel::RootProblem;
pub use parallel::RootSettings;
pub use parallel::RootSolution;
pub use parallel::RootStatus;

Modules§

differentiate
Numerical differentiation of a supplied function — finite differences, batched derivatives, and batched Jacobians, dispatched across ComputeBackend.
erf_inv
inc_gamma
inv_inc_gamma
minimise
Batched derivative-free 1-D golden-section extremum search on the hybrid execution backend — contract N independent brackets at once, serially or across CPU cores.
parallel
Batched scalar root finding on the hybrid execution backend — solve N independent f(x) = 0 problems at once, serially or across CPU cores.