pub struct MapVecMatrix<'a, CF, ColT, RowT>{
pub columns: Cow<'a, FxHashMap<ColT, Vec<(CF, RowT)>>>,
}Expand description
A sprase matrix stored as a FxHashMap<Column> where each Column is a vector of the non-zero entries.
The columns are indexed by any Hash type and the rows are indexed by an arbitrary type.
This is similar to the typical sparse matrix representation in other frameworks.
Fields§
§columns: Cow<'a, FxHashMap<ColT, Vec<(CF, RowT)>>>The columns of the matrix.
This is stored behind a Cow to allow construction whether you own columns or not
Trait Implementations§
Source§impl<'a, CF, ColT, RowT> From<&'a HashMap<ColT, Vec<(CF, RowT)>, BuildHasherDefault<FxHasher>>> for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> From<&'a HashMap<ColT, Vec<(CF, RowT)>, BuildHasherDefault<FxHasher>>> for MapVecMatrix<'a, CF, ColT, RowT>
Source§impl<CF, ColT, RowT> From<HashMap<ColT, Vec<(CF, RowT)>, BuildHasherDefault<FxHasher>>> for MapVecMatrix<'static, CF, ColT, RowT>
impl<CF, ColT, RowT> From<HashMap<ColT, Vec<(CF, RowT)>, BuildHasherDefault<FxHasher>>> for MapVecMatrix<'static, CF, ColT, RowT>
Source§impl<'a, CF, ColT, RowT> MatrixOracle for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> MatrixOracle for MapVecMatrix<'a, CF, ColT, RowT>
Source§type CoefficientField = CF
type CoefficientField = CF
Represents the non-zero elements in the field over which we are doing linear algebra.
Source§fn column(
&self,
col: Self::ColT,
) -> impl Iterator<Item = (Self::CoefficientField, Self::RowT)>
fn column( &self, col: Self::ColT, ) -> impl Iterator<Item = (Self::CoefficientField, Self::RowT)>
Given an element
col in the domain basis, express the image of col under the linear transformation as a linear combination of elements in the target basis.
You should provide this combination is an iterator of (coeff, row) tuples where each row is an element of the target basis.
If coeff is 0 then omit this term from the linear combination. Read moreSource§fn eq_on_col<M2>(&self, other: &M2, col: Self::ColT) -> boolwhere
Self: Sized,
M2: MatrixOracle<CoefficientField = Self::CoefficientField, ColT = Self::ColT, RowT = Self::RowT>,
fn eq_on_col<M2>(&self, other: &M2, col: Self::ColT) -> boolwhere
Self: Sized,
M2: MatrixOracle<CoefficientField = Self::CoefficientField, ColT = Self::ColT, RowT = Self::RowT>,
Checks that the matricies are equal on the specified col, ignoring ordering due to filtration values
Source§fn with_trivial_filtration(self) -> WithTrivialFiltration<Self>where
Self: Sized,
fn with_trivial_filtration(self) -> WithTrivialFiltration<Self>where
Self: Sized,
Endows
self with a filtration in which all rows have the same filtration value: ().Source§fn with_filtration<FT: FiltrationValue, F: Fn(Self::RowT) -> FT>(
self,
filtration_function: F,
) -> WithFuncFiltration<Self, FT, F>where
Self: Sized,
fn with_filtration<FT: FiltrationValue, F: Fn(Self::RowT) -> FT>(
self,
filtration_function: F,
) -> WithFuncFiltration<Self, FT, F>where
Self: Sized,
Endows
self with the filtration given by the provided filtration_function.Source§fn with_basis<B>(self, basis: B) -> MatrixWithBasis<Self, B>
fn with_basis<B>(self, basis: B) -> MatrixWithBasis<Self, B>
Endows
self with the basis basis.Source§fn reverse(self) -> ReverseMatrix<Self>where
Self: Sized,
fn reverse(self) -> ReverseMatrix<Self>where
Self: Sized,
Reverse the order on both the rows and columns.
Both the indices and the filtration values are now the
Reverse of their previous type.Source§fn unreverse<ColT, RowT>(self) -> UnreverseMatrix<Self>
fn unreverse<ColT, RowT>(self) -> UnreverseMatrix<Self>
Reverse the order on both the rows and columns.
Can only be called when the indices are of the form
Reverse<ColT> and Reverse<RowT>
Returns a matrix indexed by ColT and RowT.
Additionally, the filtration value can be ‘unreversed’.
Can be useful when self was obtained by reducing a reversed matrix.Source§fn consolidate(self) -> Consolidator<Self>where
Self: Sized,
fn consolidate(self) -> Consolidator<Self>where
Self: Sized,
When accessing a
column of the consolidated matrix, the corresponding column of self will be requested and stored into a binary heap.
An iterator through this binary heap is then returned. Read moreSource§fn cache_cols(self) -> WithCachedCols<Self>where
Self: Sized,
fn cache_cols(self) -> WithCachedCols<Self>where
Self: Sized,
Auto Trait Implementations§
impl<'a, CF, ColT, RowT> Freeze for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> RefUnwindSafe for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> Send for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> Sync for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> Unpin for MapVecMatrix<'a, CF, ColT, RowT>
impl<'a, CF, ColT, RowT> UnwindSafe for MapVecMatrix<'a, CF, ColT, RowT>where
ColT: UnwindSafe + RefUnwindSafe,
CF: UnwindSafe + RefUnwindSafe,
RowT: UnwindSafe + RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more