Trait russell_sparse::ComplexLinSolTrait

source ·
pub trait ComplexLinSolTrait {
    // Required methods
    fn factorize(
        &mut self,
        mat: &mut ComplexSparseMatrix,
        params: Option<LinSolParams>
    ) -> Result<(), StrError>;
    fn solve(
        &mut self,
        x: &mut ComplexVector,
        mat: &ComplexSparseMatrix,
        rhs: &ComplexVector,
        verbose: bool
    ) -> Result<(), StrError>;
    fn update_stats(&self, stats: &mut StatsLinSol);
    fn get_ns_init(&self) -> u128;
    fn get_ns_fact(&self) -> u128;
    fn get_ns_solve(&self) -> u128;
}
Expand description

Defines a unified interface for complex linear system solvers

Required Methods§

source

fn factorize( &mut self, mat: &mut ComplexSparseMatrix, params: Option<LinSolParams> ) -> Result<(), StrError>

Performs the factorization (and analysis/initialization if needed)

§Input
  • mat – The sparse matrix (COO, CSC, or CSR).
  • params – configuration parameters; None => use default
§Notes
  1. The structure of the matrix (nrow, ncol, nnz, sym) must be exactly the same among multiple calls to factorize. The values may differ from call to call, nonetheless.
  2. The first call to factorize will define the structure which must be kept the same for the next calls.
  3. If the structure of the matrix needs to be changed, the solver must be “dropped” and a new solver allocated.
source

fn solve( &mut self, x: &mut ComplexVector, mat: &ComplexSparseMatrix, rhs: &ComplexVector, verbose: bool ) -> Result<(), StrError>

Computes the solution of the linear system

Solves the linear system:

  A   · x = rhs
(m,n)  (n)  (m)
§Output
  • x – the vector of unknown values with dimension equal to mat.ncol
§Input
  • mat – the coefficient matrix A.
  • rhs – the right-hand side vector with know values an dimension equal to mat.ncol
  • verbose – shows messages

Warning: the matrix must be same one used in factorize.

source

fn update_stats(&self, stats: &mut StatsLinSol)

Updates the stats structure (should be called after solve)

source

fn get_ns_init(&self) -> u128

Returns the nanoseconds spent on initialize

source

fn get_ns_fact(&self) -> u128

Returns the nanoseconds spent on factorize

source

fn get_ns_solve(&self) -> u128

Returns the nanoseconds spent on solve

Implementors§