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 resize_cols(&mut self, ncols: IndexType);
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 with efficient column access operations.
This trait represents matrices stored in column-major order, where accessing matrix columns is efficient. It supports:
- Matrix views and mutable views
- Matrix-matrix multiplication (GEMM)
- Column operations (axpy, access, modification)
- Element access and modification
- Matrix resizing
The column-major layout makes operations on individual or ranges of columns very efficient.
Required Associated Types§
Sourcetype View<'a>: MatrixView<'a, Owned = Self, T = Self::T, V = Self::V>
where
Self: 'a
type View<'a>: MatrixView<'a, Owned = Self, T = Self::T, V = Self::V> where Self: 'a
A view of the dense matrix type
Required Methods§
Sourcefn gemm(&mut self, alpha: Self::T, a: &Self, b: &Self, beta: Self::T)
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
Sourcefn column_axpy(&mut self, alpha: Self::T, j: IndexType, i: IndexType)
fn column_axpy(&mut self, alpha: Self::T, j: IndexType, i: IndexType)
Perform a column AXPY operation: column i = alpha * column j + column i
This is equivalent to: self[:, i] += alpha * self[:, j]
Sourcefn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>
fn columns(&self, start: IndexType, end: IndexType) -> Self::View<'_>
Get an immutable view of columns from start (inclusive) to end (exclusive).
Sourcefn column(&self, i: IndexType) -> <Self::V as Vector>::View<'_>
fn column(&self, i: IndexType) -> <Self::V as Vector>::View<'_>
Get an immutable vector view of column i.
Sourcefn columns_mut(&mut self, start: IndexType, end: IndexType) -> Self::ViewMut<'_>
fn columns_mut(&mut self, start: IndexType, end: IndexType) -> Self::ViewMut<'_>
Get a mutable view of columns from start (inclusive) to end (exclusive).
Sourcefn column_mut(&mut self, i: IndexType) -> <Self::V as Vector>::ViewMut<'_>
fn column_mut(&mut self, i: IndexType) -> <Self::V as Vector>::ViewMut<'_>
Get a mutable vector view of column i.
Sourcefn set_index(&mut self, i: IndexType, j: IndexType, value: Self::T)
fn set_index(&mut self, i: IndexType, j: IndexType, value: Self::T)
Set the value at the given row and column indices.
Sourcefn get_index(&self, i: IndexType, j: IndexType) -> Self::T
fn get_index(&self, i: IndexType, j: IndexType) -> Self::T
Get the value at the given row and column indices.
Sourcefn resize_cols(&mut self, ncols: IndexType)
fn resize_cols(&mut self, ncols: IndexType)
Resize the number of columns in the matrix, preserving existing data.
New elements (if added) are uninitialized. If the number of columns decreases, trailing columns are discarded.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".