pub struct MatrixBuilder { /* private fields */ }Expand description
Fluent builder for matrix operations
Implementations§
Source§impl MatrixBuilder
impl MatrixBuilder
Sourcepub fn from_data(
data: Vec<f32>,
rows: usize,
cols: usize,
) -> Result<Self, String>
pub fn from_data( data: Vec<f32>, rows: usize, cols: usize, ) -> Result<Self, String>
Create from existing data
Sourcepub fn random(rows: usize, cols: usize, min: f32, max: f32) -> Self
pub fn random(rows: usize, cols: usize, min: f32, max: f32) -> Self
Create a matrix filled with random values
Sourcepub fn set(self, row: usize, col: usize, value: f32) -> Result<Self, String>
pub fn set(self, row: usize, col: usize, value: f32) -> Result<Self, String>
Set a value at position (row, col)
Sourcepub fn transpose(self) -> Self
pub fn transpose(self) -> Self
Transpose the matrix
Converts an MxN matrix to an NxM matrix by swapping rows and columns. Uses row-major to row-major transposition for cache efficiency.
Sourcepub fn multiply(&self, other: &MatrixBuilder) -> Result<MatrixBuilder, String>
pub fn multiply(&self, other: &MatrixBuilder) -> Result<MatrixBuilder, String>
Multiply by another matrix
Computes C = A × B where A is self (MxN), B is other (NxP), and C is (MxP). Uses standard O(M×N×P) algorithm with row-major order optimization.
Sourcepub fn multiply_vector(&self, vector: &[f32]) -> Result<Vec<f32>, String>
pub fn multiply_vector(&self, vector: &[f32]) -> Result<Vec<f32>, String>
Multiply by a vector
Computes y = A × x where A is self (MxN), x is vector (N), and y is (M). Uses row-major order for cache-efficient access.
Sourcepub fn dimensions(&self) -> (usize, usize)
pub fn dimensions(&self) -> (usize, usize)
Get matrix dimensions
Trait Implementations§
Source§impl Clone for MatrixBuilder
impl Clone for MatrixBuilder
Source§fn clone(&self) -> MatrixBuilder
fn clone(&self) -> MatrixBuilder
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for MatrixBuilder
impl RefUnwindSafe for MatrixBuilder
impl Send for MatrixBuilder
impl Sync for MatrixBuilder
impl Unpin for MatrixBuilder
impl UnsafeUnpin for MatrixBuilder
impl UnwindSafe for MatrixBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more