MapVecMatrix

Struct MapVecMatrix 

Source
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>

Source§

fn from(value: &'a FxHashMap<ColT, Vec<(CF, RowT)>>) -> Self

Converts to this type from the input type.
Source§

impl<CF, ColT, RowT> From<HashMap<ColT, Vec<(CF, RowT)>, BuildHasherDefault<FxHasher>>> for MapVecMatrix<'static, CF, ColT, RowT>

Source§

fn from(value: FxHashMap<ColT, Vec<(CF, RowT)>>) -> Self

Converts to this type from the input type.
Source§

impl<'a, CF, ColT, RowT> MatrixOracle for MapVecMatrix<'a, CF, ColT, RowT>

Source§

type CoefficientField = CF

Represents the non-zero elements in the field over which we are doing linear algebra.
Source§

type ColT = ColT

Represents elements in the domain basis.
Source§

type RowT = RowT

Represents elements in the target basis.
Source§

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 more
Source§

fn eq_on_col<M2>(&self, other: &M2, col: Self::ColT) -> bool
where 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,

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,

Endows self with the filtration given by the provided filtration_function.
Source§

fn with_basis<B>(self, basis: B) -> MatrixWithBasis<Self, B>
where Self: Sized, B: ColBasis<ElemT = Self::ColT>,

Endows self with the basis basis.
Source§

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>
where Self: Sized + MatrixOracle<RowT = Reverse<RowT>, ColT = Reverse<ColT>>,

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,

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 more
Source§

fn cache_cols(self) -> WithCachedCols<Self>
where Self: Sized,

Returns a wrapper around self which caches any calls to column in an internal HashMap. Read more

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>
where ColT: RefUnwindSafe, CF: RefUnwindSafe, RowT: RefUnwindSafe,

§

impl<'a, CF, ColT, RowT> Send for MapVecMatrix<'a, CF, ColT, RowT>
where ColT: Send + Sync, CF: Send + Sync, RowT: Send + Sync,

§

impl<'a, CF, ColT, RowT> Sync for MapVecMatrix<'a, CF, ColT, RowT>
where ColT: Sync, CF: Sync, RowT: Sync,

§

impl<'a, CF, ColT, RowT> Unpin for MapVecMatrix<'a, CF, ColT, RowT>
where ColT: Unpin, CF: Unpin, RowT: Unpin,

§

impl<'a, CF, ColT, RowT> UnwindSafe for MapVecMatrix<'a, CF, ColT, RowT>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<M> SquareMatrix for M
where M: MatrixOracle<ColT = <M as MatrixOracle>::RowT>,