[−][src]Struct alg_ds::ds::matrix::Matrix
Rectangular table of elements (two-dimensional array).
Methods
impl<'a, T> Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
pub fn new(rows: usize, cols: usize) -> Self
[src]
Creates new Matrix and fills it with default values.
rows
- rows number.
cols
- columns number.
Panic, if memory allocation is not succesfully.
pub fn clear(&mut self)
[src]
Fills matrix with a default values.
pub fn fill(&mut self, value: T)
[src]
Fills matrix with a value
.
pub fn rows(&self) -> usize
[src]
Returns rows number.
pub fn cols(&self) -> usize
[src]
Returns columns number.
pub fn elements_number(&self) -> usize
[src]
Returns number of elements in matrix.
pub fn nth(&self, index: usize) -> &T
[src]
Returns the n-th element of the table in line traversal order.
pub fn get(&self, row: usize, col: usize) -> &T
[src]
Returns value at [row][col] position.
There are bounds checking. If index out of range, then panic.
pub fn set(&mut self, row: usize, col: usize, value: T)
[src]
Sets the value
of element at [row][col] position.
There are bounds checking. If index out of range, then panic.
pub fn iter(&self) -> Iter<T>
[src]
Iterator over matrix in line traversal order.
pub fn iter_mut(&mut self) -> IterMut<T>
[src]
Mutable iterator over matrix in line traversal order.
Trait Implementations
impl<'a, T> Add<Matrix<'a, T>> for Matrix<'a, T> where
T: Default + Clone + Add<Output = T>,
[src]
T: Default + Clone + Add<Output = T>,
type Output = Self
The resulting type after applying the +
operator.
fn add(self, other: Self) -> Self
[src]
Performs addition of two matrices. Panics, if the sizes of the operands do not match.
impl<'a, T> Clone for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'a, T> Debug for Matrix<'a, T> where
T: Default + Clone + Display,
[src]
T: Default + Clone + Display,
impl<'a, T> Deref for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
impl<'a, T> DerefMut for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
impl<'a, T> Drop for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
impl<'a, T> Index<usize> for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
type Output = [T]
The returned type after indexing.
fn index(&self, row: usize) -> &Self::Output
[src]
impl<'a, T> IndexMut<usize> for Matrix<'a, T> where
T: Default + Clone,
[src]
T: Default + Clone,
impl<'a, T> Mul<T> for Matrix<'a, T> where
T: Default + Clone + Mul<Output = T>,
[src]
T: Default + Clone + Mul<Output = T>,
type Output = Self
The resulting type after applying the *
operator.
fn mul(self, value: T) -> Self
[src]
Performs multiplication the matrix by a number.
impl<'a, T> PartialEq<Matrix<'a, T>> for Matrix<'a, T> where
T: Default + Clone + PartialEq,
[src]
T: Default + Clone + PartialEq,
impl<'a, T> Sub<Matrix<'a, T>> for Matrix<'a, T> where
T: Default + Clone + Sub<Output = T>,
[src]
T: Default + Clone + Sub<Output = T>,
Auto Trait Implementations
impl<'a, T> RefUnwindSafe for Matrix<'a, T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, T> Send for Matrix<'a, T> where
T: Send,
T: Send,
impl<'a, T> Sync for Matrix<'a, T> where
T: Sync,
T: Sync,
impl<'a, T> Unpin for Matrix<'a, T>
impl<'a, T> !UnwindSafe for Matrix<'a, T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,