[−][src]Struct artha::matrix::Matrix
A 2D generic Matrix with Vec<Vec<T>>
as underlying data structure
Fields
dim: (usize, usize)
Methods
impl<T> Matrix<T>
[src]
pub fn new() -> Self
[src]
Creates a new Matrix
pub fn dot(&self, another: &Matrix<T>) -> Result<Matrix<T>, Box<dyn Error>> where
T: Mul + AddAssign + AddAssign<<T as Mul>::Output> + Copy + Default + Debug,
[src]
T: Mul + AddAssign + AddAssign<<T as Mul>::Output> + Copy + Default + Debug,
Computes the dot product of this matrix with another i.e matrix multiplication
pub fn transpose(&self) -> Matrix<T> where
T: Default + Debug + Copy,
[src]
T: Default + Debug + Copy,
Returns the tranpose of the given Matrix
pub fn max(&self) -> Result<Vec<T>, Box<dyn Error>> where
T: PartialOrd + Default + Copy,
[src]
T: PartialOrd + Default + Copy,
Finds the maximum of each column in the matrix and returns them as Vec
Methods from Deref<Target = Vec<Vec<T>>>
pub fn capacity(&self) -> usize
1.0.0[src]
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T]
1.7.0[src]
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn len(&self) -> usize
1.0.0[src]
Returns the number of elements in the vector, also referred to as its 'length'.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl<T: Copy> Clone for Matrix<T>
[src]
fn clone(&self) -> Matrix<T>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T> From<Vec<Vec<T>>> for Matrix<T>
[src]
impl<T> Display for Matrix<T> where
T: Display,
[src]
T: Display,
impl<T: Debug> Debug for Matrix<T>
[src]
impl<T: Add<Output = T> + Copy> Add<Matrix<T>> for Matrix<T>
[src]
type Output = Matrix<T>
The resulting type after applying the +
operator.
fn add(self, other: Matrix<T>) -> Matrix<T>
[src]
impl<T: Sub<Output = T> + Copy> Sub<Matrix<T>> for Matrix<T>
[src]
type Output = Matrix<T>
The resulting type after applying the -
operator.
fn sub(self, other: Matrix<T>) -> Matrix<T>
[src]
impl<T: Mul<Output = T> + Copy> Mul<Matrix<T>> for Matrix<T>
[src]
type Output = Matrix<T>
The resulting type after applying the *
operator.
fn mul(self, other: Matrix<T>) -> Matrix<T>
[src]
impl<T: Add<Output = T> + Copy> AddAssign<Matrix<T>> for Matrix<T>
[src]
fn add_assign(&mut self, other: Matrix<T>)
[src]
impl<T> Deref for Matrix<T>
[src]
type Target = Vec<Vec<T>>
The resulting type after dereferencing.
fn deref(&self) -> &Vec<Vec<T>>
[src]
impl<T> FromIterator<Vec<T>> for Matrix<T>
[src]
fn from_iter<I: IntoIterator<Item = Vec<T>>>(iter: I) -> Self
[src]
Auto Trait Implementations
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,