pub trait StructuredMatrix<A>{
// 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§
Sourcefn get(&self, i: usize, j: usize) -> LinalgResult<A>
fn get(&self, i: usize, j: usize) -> LinalgResult<A>
Returns the element at position (i, j)
Sourcefn matvec(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>
fn matvec(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>
Multiply the matrix by a vector (matrix-vector product)
Sourcefn matvec_transpose(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>
fn matvec_transpose(&self, x: &ArrayView1<'_, A>) -> LinalgResult<Array1<A>>
Multiply the transpose of the matrix by a vector
Provided Methods§
Sourcefn to_dense(&self) -> LinalgResult<Array2<A>>
fn to_dense(&self) -> LinalgResult<Array2<A>>
Convert the structured matrix to a dense ndarray representation
Sourcefn to_operator(&self) -> LinearOperator<A>
fn to_operator(&self) -> LinearOperator<A>
Create a matrix-free operator from this structured matrix