Skip to main content

DynLu

Struct DynLu 

Source
pub struct DynLu<T> { /* private fields */ }
Expand description

LU decomposition of a dynamically-sized square matrix.

Stores the packed L/U factors and permutation vector.

§Example

use numeris::{DynMatrix, DynVector};

let a = DynMatrix::from_slice(2, 2, &[2.0_f64, 1.0, 5.0, 3.0]);
let lu = a.lu().unwrap();

let b = DynVector::from_slice(&[4.0, 11.0]);
let x = lu.solve(&b);
assert!((x[0] - 1.0).abs() < 1e-12);
assert!((x[1] - 2.0).abs() < 1e-12);

Implementations§

Source§

impl<T: LinalgScalar> DynLu<T>

Source

pub fn new(a: &DynMatrix<T>) -> Result<Self, LinalgError>

Decompose a matrix. Returns an error if the matrix is singular.

Source

pub fn solve(&self, b: &DynVector<T>) -> DynVector<T>

Solve Ax = b for x.

Source

pub fn inverse(&self) -> DynMatrix<T>

Compute the matrix inverse.

Source

pub fn det(&self) -> T

Compute the determinant.

Trait Implementations§

Source§

impl<T: Debug> Debug for DynLu<T>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<T> Freeze for DynLu<T>

§

impl<T> RefUnwindSafe for DynLu<T>
where T: RefUnwindSafe,

§

impl<T> Send for DynLu<T>
where T: Send,

§

impl<T> Sync for DynLu<T>
where T: Sync,

§

impl<T> Unpin for DynLu<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for DynLu<T>

§

impl<T> UnwindSafe for DynLu<T>
where T: 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, 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.