Skip to main content

MatVec

Trait MatVec 

Source
pub trait MatVec<V> {
    // Required method
    fn matvec(&self, x: &V) -> V;
}
Expand description

Matrix-vector product y = A x.

§Contract

  • Caller must: pass x whose length equals self.ncols(). Backends panic on shape mismatch.
  • Implementor must: return a freshly allocated V of length self.nrows(), with y[i] = Σⱼ A[i, j] · x[j]. The op is a pure function of (self, x).

§Backends

Implemented on every backend’s dense matrix type: DenseMatrix (with V = Vec<f64>, always available), nalgebra::DMatrix<f64> (V = DVector<f64>), faer::Mat<f64> (V = faer::Col<f64>), and ndarray::Array2<f64> (V = Array1<f64>) — each behind its backend feature where applicable.

Required Methods§

Source

fn matvec(&self, x: &V) -> V

Compute A x, allocating a fresh V of length self.nrows().

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl MatVec<Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>> for CscMatrix<f64>

Available on crate feature nalgebra only.
Source§

fn matvec(&self, x: &DVector<f64>) -> DVector<f64>

Source§

impl MatVec<Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>> for DMatrix<f64>

Available on crate feature nalgebra only.
Source§

fn matvec(&self, x: &DVector<f64>) -> DVector<f64>

Source§

impl MatVec<ArrayBase<OwnedRepr<f64>, Dim<[usize; 1]>>> for Array2<f64>

Available on crate feature ndarray only.
Source§

fn matvec(&self, x: &Array1<f64>) -> Array1<f64>

Source§

impl MatVec<Col<Own<f64>>> for Mat<f64>

Available on crate feature faer only.
Source§

fn matvec(&self, x: &Col<f64>) -> Col<f64>

Source§

impl MatVec<Col<Own<f64>>> for SparseColMat<usize, f64>

Available on crate feature faer only.
Source§

fn matvec(&self, x: &Col<f64>) -> Col<f64>

Implementors§