Trait DenseMatrix

Source
pub trait DenseMatrix:
    Matrix
    + for<'b> MatrixOpsByValue<&'b Self, Self>
    + for<'b> MatrixMutOpsByValue<&'b Self>
    + for<'a, 'b> MatrixOpsByValue<&'b Self::View<'a>, Self>
    + for<'a, 'b> MatrixMutOpsByValue<&'b Self::View<'a>> {
    type View<'a>: MatrixView<'a, Owned = Self, T = Self::T, V = Self::V>
       where Self: 'a;
    type ViewMut<'a>: MatrixViewMut<'a, Owned = Self, T = Self::T, V = Self::V, View = Self::View<'a>>
       where Self: 'a;

    // Required methods
    fn gemm(&mut self, alpha: Self::T, a: &Self, b: &Self, beta: Self::T);
    fn column_axpy(&mut self, alpha: Self::T, j: IndexType, i: IndexType);
    fn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>;
    fn column(&self, i: IndexType) -> <Self::V as Vector>::View<'_>;
    fn columns_mut(
        &mut self,
        start: IndexType,
        end: IndexType,
    ) -> Self::ViewMut<'_>;
    fn column_mut(&mut self, i: IndexType) -> <Self::V as Vector>::ViewMut<'_>;
    fn set_index(&mut self, i: IndexType, j: IndexType, value: Self::T);
    fn get_index(&self, i: IndexType, j: IndexType) -> Self::T;
    fn from_vec(
        nrows: IndexType,
        ncols: IndexType,
        data: Vec<Self::T>,
        ctx: Self::C,
    ) -> Self;

    // Provided method
    fn mat_mul(&self, b: &Self) -> Self { ... }
}
Expand description

A dense column-major matrix. The assumption is that the underlying matrix is stored in column-major order, so functions for taking columns views are efficient

Required Associated Types§

Source

type View<'a>: MatrixView<'a, Owned = Self, T = Self::T, V = Self::V> where Self: 'a

A view of the dense matrix type

Source

type ViewMut<'a>: MatrixViewMut<'a, Owned = Self, T = Self::T, V = Self::V, View = Self::View<'a>> where Self: 'a

A mutable view of the dense matrix type

Required Methods§

Source

fn gemm(&mut self, alpha: Self::T, a: &Self, b: &Self, beta: Self::T)

Perform a matrix-matrix multiplication self = alpha * a * b + beta * self, where alpha and beta are scalars, and a and b are matrices

Source

fn column_axpy(&mut self, alpha: Self::T, j: IndexType, i: IndexType)

Performs an axpy operation on two columns of the matrix M[:, i] = alpha * M[:, j] + M[:, i]

Source

fn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>

Get a matrix view of the columns starting at start and ending at end

Source

fn column(&self, i: IndexType) -> <Self::V as Vector>::View<'_>

Get a vector view of the column i

Source

fn columns_mut(&mut self, start: IndexType, end: IndexType) -> Self::ViewMut<'_>

Get a mutable matrix view of the columns starting at start and ending at end

Source

fn column_mut(&mut self, i: IndexType) -> <Self::V as Vector>::ViewMut<'_>

Get a mutable vector view of the column i

Source

fn set_index(&mut self, i: IndexType, j: IndexType, value: Self::T)

Set the value at a given index

Source

fn get_index(&self, i: IndexType, j: IndexType) -> Self::T

Get the value at a given index

Source

fn from_vec( nrows: IndexType, ncols: IndexType, data: Vec<Self::T>, ctx: Self::C, ) -> Self

creates a new matrix from a vector of values, which are assumed to be in column-major order

Provided Methods§

Source

fn mat_mul(&self, b: &Self) -> Self

mat_mat_mul using gemm, allocating a new matrix

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§