SparseMatrix

Trait SparseMatrix 

Source
pub trait SparseMatrix<'a>
where Self: Sized + Clone,
{ type Value: 'a + ValueType; type Index: 'a + IndexType; type IterRow: Iterator<Item = (&'a Self::Index, &'a Self::Value)>; const UNSET: Self::Index = <Self::Index>::MAX;
Show 29 methods // Required methods fn iter_row(&'a self, row: usize) -> Self::IterRow; fn with_capacity(cap: usize) -> Self; fn n_rows(&self) -> usize; fn n_cols(&self) -> usize; fn n_non_zero_entries(&self) -> usize; fn get(&self, i: usize, j: usize) -> Self::Value; fn get_mut(&mut self, i: usize, j: usize) -> &mut Self::Value; fn scale(&mut self, rhs: Self::Value); // Provided methods fn iter(&'a self) -> Iter<'_, Self> { ... } fn new() -> Self { ... } fn eye(dim: usize) -> Self { ... } fn empty(&self) -> bool { ... } fn add<S>(&'a mut self, rhs: &'a S) where S: SparseMatrix<'a, Value = Self::Value> { ... } fn sub<S>(&'a mut self, rhs: &'a S) where S: SparseMatrix<'a, Value = Self::Value> { ... } fn mvp<V>(&'a self, rhs: &V) -> V where V: Vector<'a, Value = Self::Value> { ... } fn inner_prod<V>(&'a self, lhs: &V, rhs: &V) -> Self::Value where V: Vector<'a, Value = Self::Value> { ... } fn transpose(&'a self) -> Self { ... } fn prod<M>(&'a self, rhs: &'a M) -> Result<Self, SparseMatError> where M: ColumnIter<'a, Index = Self::Index, Value = Self::Value> { ... } fn is_symmetric(&'a self) -> bool { ... } fn set(&mut self, i: usize, j: usize, val: Self::Value) { ... } fn add_to(&mut self, i: usize, j: usize, val: Self::Value) { ... } fn density(&self) -> f64 { ... } fn sparsity(&self) -> f64 { ... } fn is_sorted_row(&'a self, i: usize) -> bool { ... } fn is_sorted(&'a self) -> bool { ... } fn get_row(&'a self, i: usize) -> SparseVec<Self::Value, Self::Index> { ... } fn to_string_row(&'a self, i: usize) -> String { ... } fn to_string(&'a self) -> String { ... } fn to_pbm(&'a self, filename: String) { ... }
}

Provided Associated Constants§

Source

const UNSET: Self::Index = <Self::Index>::MAX

Required Associated Types§

Source

type Value: 'a + ValueType

Source

type Index: 'a + IndexType

Source

type IterRow: Iterator<Item = (&'a Self::Index, &'a Self::Value)>

Required Methods§

Source

fn iter_row(&'a self, row: usize) -> Self::IterRow

Source

fn with_capacity(cap: usize) -> Self

Source

fn n_rows(&self) -> usize

Source

fn n_cols(&self) -> usize

Source

fn n_non_zero_entries(&self) -> usize

Source

fn get(&self, i: usize, j: usize) -> Self::Value

Source

fn get_mut(&mut self, i: usize, j: usize) -> &mut Self::Value

Source

fn scale(&mut self, rhs: Self::Value)

Provided Methods§

Source

fn iter(&'a self) -> Iter<'_, Self>

Source

fn new() -> Self

Source

fn eye(dim: usize) -> Self

Source

fn empty(&self) -> bool

Source

fn add<S>(&'a mut self, rhs: &'a S)
where S: SparseMatrix<'a, Value = Self::Value>,

Source

fn sub<S>(&'a mut self, rhs: &'a S)
where S: SparseMatrix<'a, Value = Self::Value>,

Source

fn mvp<V>(&'a self, rhs: &V) -> V
where V: Vector<'a, Value = Self::Value>,

Source

fn inner_prod<V>(&'a self, lhs: &V, rhs: &V) -> Self::Value
where V: Vector<'a, Value = Self::Value>,

Source

fn transpose(&'a self) -> Self

Source

fn prod<M>(&'a self, rhs: &'a M) -> Result<Self, SparseMatError>
where M: ColumnIter<'a, Index = Self::Index, Value = Self::Value>,

Source

fn is_symmetric(&'a self) -> bool

Source

fn set(&mut self, i: usize, j: usize, val: Self::Value)

Source

fn add_to(&mut self, i: usize, j: usize, val: Self::Value)

Source

fn density(&self) -> f64

Source

fn sparsity(&self) -> f64

Source

fn is_sorted_row(&'a self, i: usize) -> bool

Source

fn is_sorted(&'a self) -> bool

Source

fn get_row(&'a self, i: usize) -> SparseVec<Self::Value, Self::Index>

Source

fn to_string_row(&'a self, i: usize) -> String

Source

fn to_string(&'a self) -> String

Source

fn to_pbm(&'a self, filename: String)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'a, M> SparseMatrix<'a> for SparseMatPar<M>
where M: 'a + SparseMatrix<'a>,

Source§

type Value = <M as SparseMatrix<'a>>::Value

Source§

type Index = <M as SparseMatrix<'a>>::Index

Source§

type IterRow = <M as SparseMatrix<'a>>::IterRow

Source§

impl<'a, T, I> SparseMatrix<'a> for SparseMatCRS<T, I>
where T: 'a + ValueType, I: 'a + IndexType,

Source§

type Value = T

Source§

type Index = I

Source§

type IterRow = Zip<Iter<'a, I>, Iter<'a, T>>

Source§

impl<'a, T, I> SparseMatrix<'a> for SparseMatIndexList<T, I>
where T: 'a + ValueType, I: 'a + IndexType,

Source§

type Value = T

Source§

type Index = I

Source§

type IterRow = IterRow<'a, T, I>

Source§

impl<'a, T, I> SparseMatrix<'a> for SparseMatRowVec<T, I>
where T: 'a + ValueType, I: 'a + IndexType,

Source§

type Value = T

Source§

type Index = I

Source§

type IterRow = Zip<Iter<'a, I>, Iter<'a, T>>