Module ndarray_linalg::cholesky

source ·
Expand description

Cholesky decomposition of Hermitian (or real symmetric) positive definite matrices

See the Wikipedia page about Cholesky decomposition for more information.

§Example

Using the Cholesky decomposition of A for various operations, where A is a Hermitian (or real symmetric) positive definite matrix:

#[macro_use]
extern crate ndarray;
extern crate ndarray_linalg;

use ndarray::prelude::*;
use ndarray_linalg::cholesky::*;

let a: Array2<f64> = array![
    [  4.,  12., -16.],
    [ 12.,  37., -43.],
    [-16., -43.,  98.]
];

// Obtain `L`
let lower = a.cholesky(UPLO::Lower).unwrap();
assert!(lower.abs_diff_eq(&array![
    [ 2., 0., 0.],
    [ 6., 1., 0.],
    [-8., 5., 3.]
], 1e-9));

// Find the determinant of `A`
let det = a.detc().unwrap();
assert!((det - 36.).abs() < 1e-9);

// Solve `A * x = b`
let b = array![4., 13., -11.];
let x = a.solvec(&b).unwrap();
assert!(x.abs_diff_eq(&array![-2., 1., 0.], 1e-9));

Structs§

  • Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix

Enums§

  • Upper/Lower specification for seveal usages

Traits§

  • Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix reference
  • Cholesky decomposition of Hermitian (or real symmetric) positive definite mutable reference of matrix
  • Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
  • Determinant of Hermitian (or real symmetric) positive definite matrix ref
  • Determinant of Hermitian (or real symmetric) positive definite matrix
  • Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix reference
  • Cholesky decomposition of Hermitian (or real symmetric) positive definite matrix
  • Inverse of Hermitian (or real symmetric) positive definite matrix ref
  • Inverse of Hermitian (or real symmetric) positive definite matrix
  • Solve systems of linear equations with Hermitian (or real symmetric) positive definite coefficient matrices