Skip to main content

SparseSymLinearSolverInterface

Trait SparseSymLinearSolverInterface 

Source
pub trait SparseSymLinearSolverInterface {
    // Required methods
    fn initialize_structure(
        &mut self,
        dim: Index,
        nonzeros: Index,
        ia: &[Index],
        ja: &[Index],
    ) -> ESymSolverStatus;
    fn values_array_mut(&mut self) -> &mut [Number] ;
    fn multi_solve(
        &mut self,
        new_matrix: bool,
        ia: &[Index],
        ja: &[Index],
        nrhs: Index,
        rhs_vals: &mut [Number],
        check_neg_evals: bool,
        number_of_neg_evals: Index,
    ) -> ESymSolverStatus;
    fn number_of_neg_evals(&self) -> Index;
    fn increase_quality(&mut self) -> bool;
    fn provides_inertia(&self) -> bool;
    fn matrix_format(&self) -> EMatrixFormat;

    // Provided methods
    fn provides_degeneracy_detection(&self) -> bool { ... }
    fn determine_dependent_rows(
        &mut self,
        _n_rows: Index,
        _n_cols: Index,
        _irn: &[Index],
        _jcn: &[Index],
        _vals: &[Number],
        _c_deps: &mut Vec<Index>,
    ) -> ESymSolverStatus { ... }
    fn factor_pattern(&self, _want_values: bool) -> Option<FactorPattern> { ... }
}
Expand description

Backend-side trait. The lifecycle mirrors upstream’s narrative comment in IpSparseSymLinearSolverInterface.hpp:

  1. caller asks Self::matrix_format.
  2. caller calls Self::initialize_structure once with (ia, ja).
  3. caller takes the values pointer from Self::values_array_mut, fills it.
  4. caller calls Self::multi_solve with new_matrix=true for each new value pattern.
  5. caller may query Self::number_of_neg_evals / Self::increase_quality between solves.

new_matrix=false requests a back-substitution against the existing factorization.

Required Methods§

Source

fn initialize_structure( &mut self, dim: Index, nonzeros: Index, ia: &[Index], ja: &[Index], ) -> ESymSolverStatus

Initialize backend internal structures for a matrix of given dimension and pattern.

Source

fn values_array_mut(&mut self) -> &mut [Number]

Slice into which the caller writes the matrix nonzeros (in the same order as ja from Self::initialize_structure).

Source

fn multi_solve( &mut self, new_matrix: bool, ia: &[Index], ja: &[Index], nrhs: Index, rhs_vals: &mut [Number], check_neg_evals: bool, number_of_neg_evals: Index, ) -> ESymSolverStatus

Factor (if new_matrix) and back-substitute against nrhs right-hand sides packed in rhs_vals (length nrhs * dim). Solutions overwrite rhs_vals.

Source

fn number_of_neg_evals(&self) -> Index

Number of negative eigenvalues found in the most recent factorization. Caller must check Self::provides_inertia first.

Source

fn increase_quality(&mut self) -> bool

Ask the backend to use a more accurate (but slower) pivot strategy on the next solve. Returns false if the maximum quality is already reached.

Source

fn provides_inertia(&self) -> bool

Whether this backend reports the number of negative eigenvalues post-factor.

Source

fn matrix_format(&self) -> EMatrixFormat

Required matrix layout. Caller marshals data into this format.

Provided Methods§

Source

fn provides_degeneracy_detection(&self) -> bool

Whether Self::determine_dependent_rows is supported.

Source

fn determine_dependent_rows( &mut self, _n_rows: Index, _n_cols: Index, _irn: &[Index], _jcn: &[Index], _vals: &[Number], _c_deps: &mut Vec<Index>, ) -> ESymSolverStatus

Find the linearly dependent rows of a constraint Jacobian J (the Ipopt-style degeneracy probe). J is n_rows × n_cols, supplied as a 1-based triplet (irn, jcn, vals); on success c_deps is filled with the 0-based indices of a set of rows whose removal leaves J full row rank (each dropped row is a linear combination of the retained ones).

Callers must check Self::provides_degeneracy_detection first. The default returns FatalError, matching upstream’s “not supported” default; backends that implement this set provides_degeneracy_detection() -> true.

Source

fn factor_pattern(&self, _want_values: bool) -> Option<FactorPattern>

Snapshot of the most recent factor’s L pattern and permutation. Backends that expose their factor data structures (e.g. feral) return Some(_); backends that don’t (e.g. MA57, which keeps its factors inside opaque Fortran work arrays) return None. Diagnostic-only — consumed by the --dump kkt:*+L path. Set want_values=true to populate FactorPattern::l_vals.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§