Trait lophat::algorithms::DecompositionAlgo
source · pub trait DecompositionAlgo<C>where
C: Column,{
type Options: Default + Copy;
type Decomposition: Decomposition<C>;
// Required methods
fn init(options: Option<Self::Options>) -> Self;
fn add_cols(self, cols: impl Iterator<Item = C>) -> Self;
fn add_entries(self, entries: impl Iterator<Item = (usize, usize)>) -> Self;
fn decompose(self) -> Self::Decomposition;
}
Expand description
A struct implementing this trait implements an algorithm for computing the R=DV decomposition of a matrix D.
The struct is initialised via the init
method, in which options for the algorithm are provided.
The D matrix is build up by using the add_cols
and add_entries
methods.
Once constructed, the decomposition is computed via the decompose
methods
Required Associated Types§
sourcetype Decomposition: Decomposition<C>
type Decomposition: Decomposition<C>
Return tupe of decompose
– should carry sufficient information to query columns of the resulting decomposition.
Required Methods§
sourcefn init(options: Option<Self::Options>) -> Self
fn init(options: Option<Self::Options>) -> Self
Initialise the algorithm with the options provided and an empty input matrix
sourcefn add_cols(self, cols: impl Iterator<Item = C>) -> Self
fn add_cols(self, cols: impl Iterator<Item = C>) -> Self
Push the provided columns onto the end of the matrix
sourcefn add_entries(self, entries: impl Iterator<Item = (usize, usize)>) -> Self
fn add_entries(self, entries: impl Iterator<Item = (usize, usize)>) -> Self
Add the provided (row, column) entries to the matrix.
If the column has not already been pushed via add_cols
then panic!()
sourcefn decompose(self) -> Self::Decomposition
fn decompose(self) -> Self::Decomposition
Decomposes the built-up matrix (D) into an R=DV decomposition, following the relevant algorithm and provided options.