Struct scirust::matrix::triangular_matrix::TriangularMatrix
[−]
[src]
pub struct TriangularMatrix<T: MagmaBase> { // some fields omitted }
Represents a triangular square matrix of numbers.
The matrix can be either upper triangular or lower triangular (but not both off course).
For an upper triangular matrix, the numbers are stored in column major order.
For a lower triangular matrix, the numbers are stored in row major order.
The difference in ordering is to simplify cell index to cell offset calculations.
The half of the matrix which is full of zeros, is not stored in memory. Thus, all calculations are done smartly.
This design is not too flexible. The memory allocation is done in the beginning and never changed afterwards. Thus, the size of the matrix remains same.
Methods
impl<T: MagmaBase> TriangularMatrix<T>
Static functions for creating a triangular matrix
fn new(size: usize, ut_flag: bool) -> TriangularMatrix<T>
Constructs a new matrix of given size (uninitialized).
impl<T: CommutativeMonoidAddPartial> TriangularMatrix<T>
fn zeros(size: usize, ut: bool) -> TriangularMatrix<T>
Constructs a triangular matrix of all zeros
impl<T: CommutativeRingPartial> TriangularMatrix<T>
fn ones(size: usize, ut: bool) -> TriangularMatrix<T>
Constructs a matrix of all ones.
impl<T: MagmaBase> TriangularMatrix<T>
Main methods of a triangular matrix
fn capacity(&self) -> usize
Returns the capacity of the matrix i.e. the number of elements it can hold
Trait Implementations
impl<T: CommutativeMonoidAddPartial> Shape<T> for TriangularMatrix<T>
Core methods for all matrix types
fn num_rows(&self) -> usize
fn num_cols(&self) -> usize
fn size(&self) -> (usize, usize)
fn num_cells(&self) -> usize
unsafe fn get_unchecked(&self, r: usize, c: usize) -> T
fn set(&mut self, r: usize, c: usize, value: T)
fn is_row(&self) -> bool
fn is_col(&self) -> bool
fn is_scalar(&self) -> bool
fn is_vector(&self) -> bool
fn is_empty(&self) -> bool
fn is_square(&self) -> bool
fn get(&self, r: usize, c: usize) -> Option<T>
fn index_to_cell(&self, index: usize) -> (usize, usize)
fn cell_to_index(&self, r: usize, c: usize) -> usize
fn smaller_dim(&self) -> usize
fn larger_dim(&self) -> usize
impl<T: CommutativeMonoidAddPartial + CommutativeMonoidMulPartial> NumberMatrix<T> for TriangularMatrix<T>
Implementation of methods for matrices of numbers
fn is_identity(&self) -> bool
fn is_diagonal(&self) -> bool
fn is_lt(&self) -> bool
fn is_ut(&self) -> bool
fn is_symmetric(&self) -> bool
fn is_triangular(&self) -> bool
fn trace(&self) -> T
impl<T> Introspection for TriangularMatrix<T>
Introspection support
fn is_triangular_matrix_type(&self) -> bool
fn is_matrix_view_type(&self) -> bool
fn is_standard_matrix_type(&self) -> bool
impl<T: MagmaBase> MatrixBuffer<T> for TriangularMatrix<T>
Buffer access
fn as_ptr(&self) -> *const T
fn as_mut_ptr(&mut self) -> *mut T
fn cell_to_offset(&self, r: usize, c: usize) -> isize
fn start_offset(&self) -> isize
impl<T: MagmaBase> Drop for TriangularMatrix<T>
fn drop(&mut self)
impl<T: CommutativeMonoidAddPartial> Extraction<T> for TriangularMatrix<T>
Implement extraction API for triangular matrix
fn row(&self, r: isize) -> Matrix<T>
fn col(&self, c: isize) -> Matrix<T>
fn sub_matrix(&self, start_row: isize, start_col: isize, num_rows: usize, num_cols: usize) -> Matrix<T>
fn ut_matrix(&self) -> Matrix<T>
fn lt_matrix(&self) -> Matrix<T>
impl<T: MagmaBase> Debug for TriangularMatrix<T>
Formatting of the triangular matrix on screen