Struct Matrix

Source
pub struct Matrix<A> { /* private fields */ }

Implementations§

Source§

impl<A: Clone> Matrix<A>

Source

pub fn new(rows: usize, cols: usize, val: A) -> Matrix<A>

Source

pub fn new_with_val( rows: usize, cols: usize, val: Vec<A>, ) -> Result<Matrix<A>, &'static str>

Source

pub fn index(&self, row: usize, col: usize) -> Result<A, &'static str>

Source

pub fn insert( &mut self, row: usize, col: usize, value: A, ) -> Result<(), &'static str>

Source

pub fn dimensions(&self) -> (usize, usize)

Source

pub fn map<F, B>(&self, f: F) -> Matrix<B>
where F: Fn(A) -> B,

Source

pub fn map2<F, B: Clone, C>( &self, m: &Matrix<B>, f: F, ) -> Result<Matrix<C>, &'static str>
where F: Fn(A, B) -> C,

Source

pub fn transpose(&self) -> Matrix<A>

Source§

impl<A: Clone + Num> Matrix<A>

Source

pub fn add(&self, m: &Matrix<A>) -> Result<Matrix<A>, &'static str>

Source

pub fn sub(&self, m: &Matrix<A>) -> Result<Matrix<A>, &'static str>

Source

pub fn scale(&self, n: A) -> Matrix<A>

Source§

impl<A: Clone + Num + Sum> Matrix<A>

Source

pub fn vec_mult(&self, v: &Vec<A>) -> Result<Vec<A>, &'static str>

Trait Implementations§

Source§

impl<A: Debug> Debug for Matrix<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: Clone + Display> Display for Matrix<A>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<A: PartialEq> PartialEq for Matrix<A>

Source§

fn eq(&self, other: &Matrix<A>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<A> StructuralPartialEq for Matrix<A>

Auto Trait Implementations§

§

impl<A> Freeze for Matrix<A>

§

impl<A> RefUnwindSafe for Matrix<A>
where A: RefUnwindSafe,

§

impl<A> Send for Matrix<A>
where A: Send,

§

impl<A> Sync for Matrix<A>
where A: Sync,

§

impl<A> Unpin for Matrix<A>
where A: Unpin,

§

impl<A> UnwindSafe for Matrix<A>
where A: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.