pub struct F32MatrixView<'a> { /* private fields */ }Expand description
Borrowed finite f32 matrix values with shape and layout metadata.
Implementations§
Source§impl<'a> F32MatrixView<'a>
impl<'a> F32MatrixView<'a>
Sourcepub fn new(shape: MatrixShape, values: &'a [f32]) -> Result<Self>
pub fn new(shape: MatrixShape, values: &'a [f32]) -> Result<Self>
Creates a row-major matrix view after validating shape and values.
Sourcepub fn shape(&self) -> MatrixShape
pub fn shape(&self) -> MatrixShape
Returns the checked row and column dimensions.
Sourcepub fn layout(&self) -> MatrixLayout
pub fn layout(&self) -> MatrixLayout
Returns how the borrowed value slice is interpreted.
Sourcepub fn transpose(self) -> Self
pub fn transpose(self) -> Self
Creates a transposed view by swapping dimensions and layout metadata.
Sourcepub fn transpose_owned(&self) -> Result<F32Matrix>
pub fn transpose_owned(&self) -> Result<F32Matrix>
Returns a row-major owned transpose of this view.
Sourcepub fn column(self, index: usize) -> Result<ColumnView<'a>>
pub fn column(self, index: usize) -> Result<ColumnView<'a>>
Borrows one logical column from this view.
Sourcepub fn get(self, row: usize, col: usize) -> Result<f32>
pub fn get(self, row: usize, col: usize) -> Result<f32>
Reads one value by logical row and column.
Sourcepub fn add(&self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn add(&self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
Adds two matrices with equal shape and returns a row-major matrix.
Sourcepub fn sub(&self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn sub(&self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
Subtracts two matrices with equal shape and returns a row-major matrix.
Sourcepub fn scale(&self, factor: f32) -> Result<F32Matrix>
pub fn scale(&self, factor: f32) -> Result<F32Matrix>
Scales every matrix value by a finite factor.
Sourcepub fn frobenius_norm(&self) -> Result<f32>
pub fn frobenius_norm(&self) -> Result<f32>
Computes the Frobenius norm.
Sourcepub fn matmul(self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn matmul(self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
Multiplies this view by another matrix view.
Sourcepub fn matvec(self, vector: &[f32]) -> Result<DenseVector>
pub fn matvec(self, vector: &[f32]) -> Result<DenseVector>
Multiplies this view by a finite dense vector.
Sourcepub fn column_sums(self) -> Result<Vec<f32>>
pub fn column_sums(self) -> Result<Vec<f32>>
Sums each logical column.
Sourcepub fn column_means(&self) -> Result<Vec<f32>>
pub fn column_means(&self) -> Result<Vec<f32>>
Averages each logical column.
Sourcepub fn l2_normalize_rows(self) -> Result<F32Matrix>
pub fn l2_normalize_rows(self) -> Result<F32Matrix>
Returns a row-major matrix whose rows have unit L2 norm.
Sourcepub fn l2_normalize_columns(self) -> Result<F32Matrix>
pub fn l2_normalize_columns(self) -> Result<F32Matrix>
Returns a row-major matrix whose columns have unit L2 norm.
Sourcepub fn pairwise_row_dot(self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn pairwise_row_dot(self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
Computes the dot product for every pair of rows in two matrices.
Sourcepub fn pairwise_row_cosine(self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn pairwise_row_cosine(self, right: &F32MatrixView<'_>) -> Result<F32Matrix>
Computes cosine similarity for every pair of rows in two matrices.
Sourcepub fn lu_decompose(&self) -> Result<LuDecomposition>
pub fn lu_decompose(&self) -> Result<LuDecomposition>
Decomposes this square matrix using LU factorization with partial pivoting.
Sourcepub fn determinant(&self) -> Result<f32>
pub fn determinant(&self) -> Result<f32>
Computes this square matrix determinant through LU decomposition.
Sourcepub fn solve_vector(&self, b: &[f32]) -> Result<Vec<f32>>
pub fn solve_vector(&self, b: &[f32]) -> Result<Vec<f32>>
Solves A x = b for a finite vector b.
Sourcepub fn solve_matrix(&self, b: &F32MatrixView<'_>) -> Result<F32Matrix>
pub fn solve_matrix(&self, b: &F32MatrixView<'_>) -> Result<F32Matrix>
Solves A X = B for matrix B.
Sourcepub fn validate(self) -> Result<()>
pub fn validate(self) -> Result<()>
Verifies shape/value count agreement and rejects non-finite values.
Sourcepub fn into_owned(self) -> Result<F32Matrix>
pub fn into_owned(self) -> Result<F32Matrix>
Copies this view into an owned row-major matrix.
Trait Implementations§
Source§impl<'a> Clone for F32MatrixView<'a>
impl<'a> Clone for F32MatrixView<'a>
Source§fn clone(&self) -> F32MatrixView<'a>
fn clone(&self) -> F32MatrixView<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'a> Debug for F32MatrixView<'a>
impl<'a> Debug for F32MatrixView<'a>
Source§impl<'a> PartialEq for F32MatrixView<'a>
impl<'a> PartialEq for F32MatrixView<'a>
Source§fn eq(&self, other: &F32MatrixView<'a>) -> bool
fn eq(&self, other: &F32MatrixView<'a>) -> bool
self and other values to be equal, and is used by ==.