pub trait AssemblyBackend: LinearizationMode {
// Required methods
fn assemble(
problem: &Problem,
variables: &HashMap<String, VariableEnum>,
variable_index_map: &HashMap<String, usize>,
symbolic_structure: Option<&SymbolicStructure>,
total_dof: usize,
) -> LinearizerResult<(Mat<f64>, Self::Jacobian)>;
fn compute_column_norms(jacobian: &Self::Jacobian) -> Vec<f64>;
fn apply_column_scaling(
jacobian: &Self::Jacobian,
scaling: &[f64],
) -> Self::Jacobian;
fn apply_inverse_scaling(step: &Mat<f64>, scaling: &[f64]) -> Mat<f64>;
fn hessian_vec_product(hessian: &Self::Hessian, vec: &Mat<f64>) -> Mat<f64>;
}Expand description
Type-level backend for assembling (residuals, Jacobian) and performing
matrix operations. Implemented by SparseMode and DenseMode.
All methods are static — this trait is used as a compile-time strategy
selector, not as an object interface. Extends LinearizationMode with
the five operations an optimizer needs each iteration: building (r, J),
scaling J, unscaling dx, and H·v.
All three optimizers (LM, GN, DogLeg) are generic over M: AssemblyBackend,
giving zero-cost static dispatch through the entire pipeline.
Required Methods§
Sourcefn assemble(
problem: &Problem,
variables: &HashMap<String, VariableEnum>,
variable_index_map: &HashMap<String, usize>,
symbolic_structure: Option<&SymbolicStructure>,
total_dof: usize,
) -> LinearizerResult<(Mat<f64>, Self::Jacobian)>
fn assemble( problem: &Problem, variables: &HashMap<String, VariableEnum>, variable_index_map: &HashMap<String, usize>, symbolic_structure: Option<&SymbolicStructure>, total_dof: usize, ) -> LinearizerResult<(Mat<f64>, Self::Jacobian)>
Assemble residuals and Jacobian from the problem.
Sourcefn compute_column_norms(jacobian: &Self::Jacobian) -> Vec<f64>
fn compute_column_norms(jacobian: &Self::Jacobian) -> Vec<f64>
Compute column norms of the Jacobian (for Jacobi scaling).
Sourcefn apply_column_scaling(
jacobian: &Self::Jacobian,
scaling: &[f64],
) -> Self::Jacobian
fn apply_column_scaling( jacobian: &Self::Jacobian, scaling: &[f64], ) -> Self::Jacobian
Apply diagonal column scaling to the Jacobian.
Returns a new Jacobian with columns scaled by 1 / (1 + norm).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.