[−][src]Struct sparse21::Matrix
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
isself
b
is argumentrhs
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,