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§
sourcefn factorize(
&mut self,
mat: &mut ComplexSparseMatrix,
params: Option<LinSolParams>
) -> Result<(), StrError>
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
- 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. - The first call to
factorizewill define the structure which must be kept the same for the next calls. - If the structure of the matrix needs to be changed, the solver must be “dropped” and a new solver allocated.
sourcefn solve(
&mut self,
x: &mut ComplexVector,
mat: &ComplexSparseMatrix,
rhs: &ComplexVector,
verbose: bool
) -> Result<(), StrError>
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.ncolverbose– shows messages
Warning: the matrix must be same one used in factorize.
sourcefn update_stats(&self, stats: &mut StatsLinSol)
fn update_stats(&self, stats: &mut StatsLinSol)
Updates the stats structure (should be called after solve)
sourcefn get_ns_init(&self) -> u128
fn get_ns_init(&self) -> u128
Returns the nanoseconds spent on initialize
sourcefn get_ns_fact(&self) -> u128
fn get_ns_fact(&self) -> u128
Returns the nanoseconds spent on factorize
sourcefn get_ns_solve(&self) -> u128
fn get_ns_solve(&self) -> u128
Returns the nanoseconds spent on solve