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<F: Scalar> MatVec<ArrayBase<OwnedRepr<F>, Dim<[usize; 1]>>> for Array2<F>

Available on crate feature ndarray only.
Source§

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

Source§

impl<F> MatVec<Col<Own<F>>> for Mat<F>
where F: Scalar + ComplexField,

Available on crate feature faer only.
Source§

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

Source§

impl<F> MatVec<Col<Own<F>>> for SparseColMat<usize, F>
where F: Scalar + ComplexField,

Available on crate feature faer only.
Source§

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

Source§

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

Available on crate feature nalgebra only.
Source§

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

Source§

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

Available on crate feature nalgebra only.
Source§

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

Implementors§

Source§

impl<F: Scalar> MatVec<Vec<F>> for DenseMatrix<F>