[][src]Struct sparse21::Matrix

pub struct Matrix { /* fields omitted */ }

Sparse Matrix

Methods

impl Matrix[src]

pub fn new() -> Matrix[src]

Create a new, initially empty Matrix

pub fn from_entries(entries: Vec<(usize, usize, f64)>) -> Matrix[src]

Create a new Matrix from a vector of (row, col, val) entries.

pub fn identity(n: usize) -> Matrix[src]

Create an n*n identity Matrix

pub fn add_element(&mut self, row: usize, col: usize, val: f64)[src]

Add an element at location (row, col) with value val.

pub fn add_elements(&mut self, elements: Vec<(usize, usize, f64)>)[src]

Add elements correspoding to each triplet (row, col, val) Rows and columns are usize, and vals are f64.

pub fn get(&self, row: usize, col: usize) -> Option<f64>[src]

Returns the Element-value at (row, col) if present, or None if not.

pub fn solve(&mut self, rhs: Vec<f64>) -> Result<Vec<f64>, &'static str>[src]

Solve the system Ax=b, where:

  • A is self
  • b is argument rhs
  • x is the return value.

Returns a Result containing the Vec<f64> representing x if successful. Returns an Err if unsuccessful.

Performs LU factorization, forward and backward substitution.

Auto Trait Implementations

impl RefUnwindSafe for Matrix

impl Send for Matrix

impl Sync for Matrix

impl Unpin for Matrix

impl UnwindSafe for Matrix

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[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, 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.