Crate oxiblas_matrix

Crate oxiblas_matrix 

Source
Expand description

OxiBLAS Matrix - Matrix types and views for OxiBLAS.

This crate provides the core matrix types for OxiBLAS:

  • Mat<T>: Owned, heap-allocated matrix with column-major storage
  • CowMat<T>: Copy-on-Write matrix for efficient sharing
  • MatRef<'a, T>: Immutable view into a matrix
  • MatMut<'a, T>: Mutable view with reborrow semantics

§Specialized Matrix Types

§Memory Layout

All matrices use column-major (Fortran) storage order. This means elements within a column are contiguous in memory. The storage is aligned for efficient SIMD operations.

§Views and Reborrows

The view types (MatRef, MatMut) do not own their data. They can represent submatrices, transposed views, or any strided data.

MatMut uses the reborrow pattern to prevent aliasing:

  • rb() creates an immutable reborrow
  • rb_mut() creates a mutable reborrow with a shorter lifetime

§Example

use oxiblas_matrix::{Mat, MatRef, MatMut};

// Create a matrix
let mut m: Mat<f64> = Mat::zeros(4, 4);

// Modify through a mutable view
{
    let mut view = m.as_mut();
    view[(0, 0)] = 1.0;
    view[(1, 1)] = 2.0;
    view[(2, 2)] = 3.0;
    view[(3, 3)] = 4.0;
}

// Read through an immutable view
let view = m.as_ref();
assert_eq!(view.diagonal()[2], 3.0);

Re-exports§

pub use cow::CowMat;
pub use mat::Mat;
pub use mat_mut::MatMut;
pub use mat_ref::DiagRef;
pub use mat_ref::MatRef;
pub use mat_ref::TransposeRef;
pub use banded::BandedMat;
pub use banded::BandedMut;
pub use banded::BandedRef;
pub use banded::SymmetricBandedMat;
pub use packed::PackedMat;
pub use packed::PackedMut;
pub use packed::PackedRef;
pub use packed::TriangularKind;
pub use prefetch::CACHE_LINE_SIZE;
pub use prefetch::MatrixPrefetcher;
pub use prefetch::PREFETCH_DISTANCE_BYTES;
pub use prefetch::PREFETCH_DISTANCE_LINES;
pub use prefetch::PrefetchLocality;
pub use prefetch::prefetch_block;
pub use prefetch::prefetch_column;
pub use prefetch::prefetch_range_read;
pub use prefetch::prefetch_range_write;
pub use prefetch::prefetch_read;
pub use prefetch::prefetch_write;
pub use symmetric::HermitianMat;
pub use symmetric::SymmetricMat;
pub use symmetric::SymmetricMut;
pub use symmetric::SymmetricRef;
pub use symmetric::SymmetricView;
pub use symmetric::SymmetricViewMut;
pub use triangular::DiagonalKind;
pub use triangular::TriangularMat;
pub use triangular::TriangularMut;
pub use triangular::TriangularRef;
pub use triangular::TriangularView;
pub use triangular::TriangularViewMut;
pub use lazy::ComplexExpr;
pub use lazy::ComplexScalar;
pub use lazy::Expr;
pub use lazy::ExprAdd;
pub use lazy::ExprConj;
pub use lazy::ExprFma;
pub use lazy::ExprGemm;
pub use lazy::ExprHermitian;
pub use lazy::ExprLeaf;
pub use lazy::ExprMul;
pub use lazy::ExprNeg;
pub use lazy::ExprScale;
pub use lazy::ExprSub;
pub use lazy::ExprTranspose;
pub use lazy::LazyExt;
pub use lazy::fma;
pub use lazy::gemm;

Modules§

banded
Banded matrix storage for matrices with limited bandwidth.
cow
Copy-on-Write matrix type.
lazy
Lazy evaluation for matrix operations.
mat
Owned matrix type.
mat_mut
Mutable matrix view type.
mat_ref
Immutable matrix view type.
ops
Matrix operations.
packed
Packed matrix storage for triangular and symmetric matrices.
prefetch
Prefetch utilities for improved cache performance.
prelude
Prelude module for convenient imports.
symmetric
Symmetric and Hermitian matrix types.
triangular
Triangular matrix types.

Structs§

Global
The global allocator.

Traits§

Alloc
A stable-Rust compatible allocator trait.