pub struct RandomMatrix { /* private fields */ }Expand description
A random matrix stored as a flat vector.
Provides basic accessors for the matrix dimensions and elements.
The data is stored as a contiguous Vec<f64> in the specified layout.
Implementations§
Source§impl RandomMatrix
impl RandomMatrix
Sourcepub fn new(
rows: usize,
cols: usize,
data: Vec<f64>,
layout: MatrixLayout,
) -> RandResult<Self>
pub fn new( rows: usize, cols: usize, data: Vec<f64>, layout: MatrixLayout, ) -> RandResult<Self>
Creates a new RandomMatrix from existing data.
§Errors
Returns RandError::InvalidSize if data.len() != rows * cols.
Sourcepub fn zeros(rows: usize, cols: usize, layout: MatrixLayout) -> Self
pub fn zeros(rows: usize, cols: usize, layout: MatrixLayout) -> Self
Creates a zero-filled matrix.
Sourcepub fn identity(n: usize, layout: MatrixLayout) -> RandResult<Self>
pub fn identity(n: usize, layout: MatrixLayout) -> RandResult<Self>
Sourcepub fn layout(&self) -> MatrixLayout
pub fn layout(&self) -> MatrixLayout
Returns the matrix layout.
Sourcepub fn frobenius_norm(&self) -> f64
pub fn frobenius_norm(&self) -> f64
Computes the Frobenius norm of the matrix.
Trait Implementations§
Source§impl Clone for RandomMatrix
impl Clone for RandomMatrix
Source§fn clone(&self) -> RandomMatrix
fn clone(&self) -> RandomMatrix
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RandomMatrix
impl Debug for RandomMatrix
Auto Trait Implementations§
impl Freeze for RandomMatrix
impl RefUnwindSafe for RandomMatrix
impl Send for RandomMatrix
impl Sync for RandomMatrix
impl Unpin for RandomMatrix
impl UnsafeUnpin for RandomMatrix
impl UnwindSafe for RandomMatrix
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