pub trait OdeSystem<S: Scalar> {
// Required methods
fn dim(&self) -> usize;
fn rhs(&self, t: S, y: &[S], dydt: &mut [S]);
// Provided methods
fn jacobian(&self, t: S, y: &[S], jac: &mut [S]) { ... }
fn is_autonomous(&self) -> bool { ... }
fn has_mass_matrix(&self) -> bool { ... }
fn mass_matrix(&self, mass: &mut [S]) { ... }
fn is_singular_mass(&self) -> bool { ... }
fn algebraic_indices(&self) -> Vec<usize> { ... }
}Expand description
A system of ordinary differential equations.
Represents: dy/dt = f(t, y)
Required Methods§
Provided Methods§
Sourcefn jacobian(&self, t: S, y: &[S], jac: &mut [S])
fn jacobian(&self, t: S, y: &[S], jac: &mut [S])
Optionally compute the Jacobian: J = ∂f/∂y Default implementation uses finite differences.
Sourcefn is_autonomous(&self) -> bool
fn is_autonomous(&self) -> bool
Is the system autonomous? (f does not depend on t explicitly)
Sourcefn has_mass_matrix(&self) -> bool
fn has_mass_matrix(&self) -> bool
Does this system have a mass matrix?
Sourcefn mass_matrix(&self, mass: &mut [S])
fn mass_matrix(&self, mass: &mut [S])
Get the mass matrix M for the DAE: M * y’ = f(t, y)
Default returns identity (standard ODE). For DAEs, override to return the (possibly singular) mass matrix.
The matrix is stored in row-major order: mass[i * n + j] = M[i, j]
Sourcefn is_singular_mass(&self) -> bool
fn is_singular_mass(&self) -> bool
Is the mass matrix singular? (i.e., is this a DAE?)
Sourcefn algebraic_indices(&self) -> Vec<usize>
fn algebraic_indices(&self) -> Vec<usize>
Return indices of algebraic variables (where M[i,i] = 0).
Default returns empty (all differential).