StructuredMatrix

Trait StructuredMatrix 

Source
pub trait StructuredMatrix<A>
where A: Float + NumAssign + Zero + Sum + One + ScalarOperand + Send + Sync + Debug,
{ // Required methods fn nrows(&self) -> usize; fn ncols(&self) -> usize; fn get(&self, i: usize, j: usize) -> LinalgResult<A>; fn matvec(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>; fn matvec_transpose(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>; // Provided methods fn shape(&self) -> (usize, usize) { ... } fn to_dense(&self) -> LinalgResult<Array2<A>> { ... } fn to_operator(&self) -> LinearOperator<A> where Self: Clone + Send + Sync + 'static { ... } }
Expand description

A trait for structured matrices that can be represented efficiently

This trait defines common operations for all structured matrices.

Required Methods§

Source

fn nrows(&self) -> usize

Returns the number of rows in the matrix

Source

fn ncols(&self) -> usize

Returns the number of columns in the matrix

Source

fn get(&self, i: usize, j: usize) -> LinalgResult<A>

Returns the element at position (i, j)

Source

fn matvec(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>

Multiply the matrix by a vector (matrix-vector product)

Source

fn matvec_transpose(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>

Multiply the transpose of the matrix by a vector

Provided Methods§

Source

fn shape(&self) -> (usize, usize)

Returns the shape of the matrix as (rows, cols)

Source

fn to_dense(&self) -> LinalgResult<Array2<A>>

Convert the structured matrix to a dense ndarray representation

Source

fn to_operator(&self) -> LinearOperator<A>
where Self: Clone + Send + Sync + 'static,

Create a matrix-free operator from this structured matrix

Implementors§