pub struct MatrixShape {
pub rows: usize,
pub cols: usize,
}Expand description
Checked dense matrix dimensions.
Fields§
§rows: usizeNumber of matrix rows.
cols: usizeNumber of matrix columns.
Implementations§
Source§impl MatrixShape
impl MatrixShape
Sourcepub fn new(rows: usize, cols: usize) -> Result<Self>
pub fn new(rows: usize, cols: usize) -> Result<Self>
Creates a shape with non-zero rows and columns.
Sourcepub fn validate(self) -> Result<()>
pub fn validate(self) -> Result<()>
Verifies non-zero dimensions and element-count overflow safety.
Sourcepub fn element_count(self) -> Result<usize>
pub fn element_count(self) -> Result<usize>
Multiplies rows by columns and fails on usize overflow.
Trait Implementations§
Source§impl Clone for MatrixShape
impl Clone for MatrixShape
Source§fn clone(&self) -> MatrixShape
fn clone(&self) -> MatrixShape
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 moreSource§impl Debug for MatrixShape
impl Debug for MatrixShape
Source§impl PartialEq for MatrixShape
impl PartialEq for MatrixShape
Source§fn eq(&self, other: &MatrixShape) -> bool
fn eq(&self, other: &MatrixShape) -> bool
Tests for
self and other values to be equal, and is used by ==.impl Copy for MatrixShape
impl Eq for MatrixShape
impl StructuralPartialEq for MatrixShape
Auto Trait Implementations§
impl Freeze for MatrixShape
impl RefUnwindSafe for MatrixShape
impl Send for MatrixShape
impl Sync for MatrixShape
impl Unpin for MatrixShape
impl UnsafeUnpin for MatrixShape
impl UnwindSafe for MatrixShape
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