[][src]Struct ohsl::matrix::Matrix

pub struct Matrix<T> { /* fields omitted */ }

Implementations

impl<T> Matrix<T>[src]

pub fn empty() -> Self[src]

Create a new matrix of unspecified size

pub fn create(mat: Vec<Vector<T>>) -> Self[src]

Create a matrix from an std::vec::Vec<Vector>

pub fn rows(&self) -> usize[src]

Return the number of rows in the matrix

pub fn cols(&self) -> usize[src]

Return the number of columns in the matrix

pub fn numel(&self) -> usize[src]

Return the number of elements in the matrix

pub fn clear(&mut self)[src]

Remove all the elements from the matrix

impl<T: Clone + Number> Matrix<T>[src]

pub fn new(rows: usize, cols: usize, elem: T) -> Self[src]

Create a new matrix of specified size

pub fn get_row(&self, row: usize) -> Vector<T>[src]

Get a row of the matrix as a vector

pub fn get_col(&self, col: usize) -> Vector<T>[src]

Get a column of the matrix as a vector

pub fn set_row(&mut self, row: usize, vec: Vector<T>)[src]

Set a row of the matrix using a vector

pub fn set_col(&mut self, col: usize, vec: Vector<T>)[src]

Set a column of the matrix using a vector

pub fn delete_row(&mut self, row: usize)[src]

Delete a row from the matrix

pub fn multiply(&self, vec: Vector<T>) -> Vector<T>[src]

Multiply the matrix by a (column) vector and return a vector

pub fn eye(size: usize) -> Self[src]

Create a square identity matrix of specified size

pub fn resize(&mut self, n_rows: usize, n_cols: usize)[src]

Resize the matrix (empty entries are appended if necessary)

pub fn transpose_in_place(&mut self)[src]

Transpose the matrix in place

pub fn transpose(&self) -> Matrix<T>[src]

Return the transpose of the matrix

pub fn swap_rows(&mut self, row_1: usize, row_2: usize)[src]

Swap two rows of the matrix

pub fn swap_elem(
    &mut self,
    row_1: usize,
    col_1: usize,
    row_2: usize,
    col_2: usize
)
[src]

Swap two elements of the matrix

pub fn fill(&mut self, elem: T)[src]

Fill the matrix with specified elements

pub fn fill_diag(&mut self, elem: T)[src]

Fill the leading diagonal of the matrix with specified elements

pub fn fill_band(&mut self, offset: isize, elem: T)[src]

Fill a diagonal band of the matrix with specified elements ( offset above main diagonal +, below main diagonal - )

pub fn fill_tridiag(&mut self, lower: T, diag: T, upper: T)[src]

Fill the main three diagonals of the matrix with specified elements

impl<T: Clone + Copy + Number + Signed + PartialOrd> Matrix<T>[src]

pub fn solve_basic(&mut self, b: Vector<T>) -> Vector<T>[src]

Solve the system of equations Ax=b where b is a specified vector using Gaussian elimination (the matrix A is modified in the process)

pub fn lu_decomp_in_place(&mut self) -> (usize, Matrix<T>)[src]

Replace the matrix with its LU decomposition and return the number of pivots and a permutation matrix

pub fn solve_lu(&mut self, b: Vector<T>) -> Vector<T>[src]

Solve the system of equations Ax=b where b is a specified vector using LU decomposition (the matrix A is modified in the process)

pub fn determinant(&self) -> T[src]

Calculate the determinant of the matrix ( via LU decomposition )

pub fn inverse(&self) -> Matrix<T>[src]

Return the inverse of the matrix ( via LU decomposition )

impl Matrix<f64>[src]

pub fn norm_1(&self) -> f64[src]

Return the matrix one-norm (max absolute column sum)

pub fn norm_inf(&self) -> f64[src]

Return the matrix inf-norm (max absolute row sum)

pub fn norm_p(&self, p: f64) -> f64[src]

Return the matrix p-norm (p=2 is Frobenius, p=inf is max norm)

pub fn norm_frob(&self) -> f64[src]

Return the matrix Frobenius norm

pub fn norm_max(&self) -> f64[src]

Return the entrywise max-norm of the matrix

pub fn jacobian(point: Vec64, func: &dyn Fn(Vec64) -> Vec64, delta: f64) -> Self[src]

Create the Jacobian matrix of a vector valued function at a point using finite-differences

impl<T: Display> Matrix<T>[src]

pub fn output(&self, filename: &str)[src]

Print the matrix to a file

Trait Implementations

impl<T: Clone + Number> Add<Matrix<T>> for Matrix<T>[src]

type Output = Self

The resulting type after applying the + operator.

pub fn add(self, plus: Self) -> Self::Output[src]

Add the elements of two matrices together ( binary + )

impl<T: Clone + Number> AddAssign<Matrix<T>> for Matrix<T>[src]

pub fn add_assign(&mut self, rhs: Self)[src]

Add a matrix to a mutable matrix and assign the result ( += )

impl<T: Clone + Number> AddAssign<T> for Matrix<T>[src]

pub fn add_assign(&mut self, rhs: T)[src]

Add the same value to every element in a mutable matrix

impl<T: Clone> Clone for Matrix<T>[src]

pub fn clone(&self) -> Self[src]

Clone the matrix

impl<T> Debug for Matrix<T> where
    T: Debug
[src]

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

Format the output

impl<T> Display for Matrix<T> where
    T: Debug
[src]

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

Format the output

impl<T: Clone + Number> Div<T> for Matrix<T>[src]

type Output = Self

The resulting type after applying the / operator.

pub fn div(self, scalar: T) -> Self::Output[src]

Divide a matrix by a scalar (matrix / scalar)

impl<T: Clone + Number> DivAssign<T> for Matrix<T>[src]

pub fn div_assign(&mut self, rhs: T)[src]

Divide a mutable matrix by a scalar (matrix /= scalar)

impl<T> Index<usize> for Matrix<T>[src]

type Output = Vector<T>

The returned type after indexing.

pub fn index<'a>(&'a self, index: usize) -> &'a Vector<T>[src]

Indexing operator [] (read only)

impl<T> IndexMut<usize> for Matrix<T>[src]

pub fn index_mut(&mut self, index: usize) -> &mut Vector<T>[src]

Indexing operator [] (read/write)

impl<T: Clone + Number> Mul<Matrix<T>> for Matrix<T>[src]

type Output = Self

The resulting type after applying the * operator.

pub fn mul(self, mul: Self) -> Self::Output[src]

Multiply two matrices together ( matrix * matrix )

impl<T: Clone + Number> Mul<T> for Matrix<T>[src]

type Output = Self

The resulting type after applying the * operator.

pub fn mul(self, scalar: T) -> Self::Output[src]

Multiply a matrix by a scalar (matrix * scalar)

impl<T: Clone + Number> Mul<Vector<T>> for Matrix<T>[src]

type Output = Vector<T>

The resulting type after applying the * operator.

pub fn mul(self, vec: Vector<T>) -> Vector<T>[src]

Multiply a matrix with a (column) vector ( matrix * vector )

impl<T: Clone + Number> MulAssign<T> for Matrix<T>[src]

pub fn mul_assign(&mut self, rhs: T)[src]

Multiply a mutable matrix by a scalar (matrix *= scalar)

impl<T: Clone + Neg<Output = T>> Neg for Matrix<T>[src]

type Output = Self

The resulting type after applying the - operator.

pub fn neg(self) -> Self::Output[src]

Return the unary negation ( unary - ) of each element

impl<T: Clone + Number> Sub<Matrix<T>> for Matrix<T>[src]

type Output = Self

The resulting type after applying the - operator.

pub fn sub(self, minus: Self) -> Self::Output[src]

Subtract the elements of one matrix from another ( binary - )

impl<T: Clone + Number> SubAssign<Matrix<T>> for Matrix<T>[src]

pub fn sub_assign(&mut self, rhs: Self)[src]

Subtract a matrix from a mutable matrix and assign the result ( -= )

impl<T: Clone + Number> SubAssign<T> for Matrix<T>[src]

pub fn sub_assign(&mut self, rhs: T)[src]

Subtract the same value from every element in a mutable matrix

Auto Trait Implementations

impl<T> RefUnwindSafe for Matrix<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Matrix<T> where
    T: Send
[src]

impl<T> Sync for Matrix<T> where
    T: Sync
[src]

impl<T> Unpin for Matrix<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Matrix<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T, Rhs> AssignOperations<Rhs> for T where
    T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs>, 
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,