[][src]Trait gramschmidt::GramSchmidt

pub trait GramSchmidt: Sized {
    fn from_shape<T>(shape: T) -> Result<Self>
    where
        T: ShapeBuilder<Dim = Ix2>
;
fn compute<S>(&mut self, a: &ArrayBase<S, Ix2>) -> Result<()>
    where
        S: Data<Elem = f64>
;
fn q(&self) -> &Array2<f64>;
fn r(&self) -> &Array2<f64>; fn from_matrix<S>(a: &ArrayBase<S, Ix2>) -> Result<Self>
    where
        S: Data<Elem = f64>
, { ... } }

Required methods

fn from_shape<T>(shape: T) -> Result<Self> where
    T: ShapeBuilder<Dim = Ix2>, 

Reserves the memory for a QR decomposition via a classical Gram Schmidt orthogonalization using a shape.

The resulting object can be used to orthogonalize matrices of the same dimensions.

Example

use gramschmidt::{
    Classical,
    GramSchmidt,
    Result,
};


let mut cgs = Classical::from_shape((10,10))?;

fn compute<S>(&mut self, a: &ArrayBase<S, Ix2>) -> Result<()> where
    S: Data<Elem = f64>, 

Computes a QR decomposition using the classical Gram Schmidt orthonormalization of the matrix a.

The input matrix a has to have exactly the same dimension and memory layout as was previously configured. Panics otherwise.

extern crate openblas_src;

use gramschmidt::{GramSchmidt, Classical};
use ndarray::Array2;
use ndarray_rand::RandomExt;
use rand::distributions::Normal;


let matrix = Array2::random((10,10), Normal::new(0.0, 1.0));
let mut cgs = Classical::from_matrix(&matrix).unwrap();
cgs.compute(&matrix);

fn q(&self) -> &Array2<f64>

Return a reference to the matrix q.

fn r(&self) -> &Array2<f64>

Return a reference to the matrix q.

Loading content...

Provided methods

fn from_matrix<S>(a: &ArrayBase<S, Ix2>) -> Result<Self> where
    S: Data<Elem = f64>, 

Uses a matrix to reserve memory for a QR decomposition via a classical Gram Schmidt.

The resulting object can be used to orthogonalize matrices of the same dimensions.

Example

use ndarray::Array;
use gramschmidt::{
    Classical,
    GramSchmidt,
    Result,
};


let a = Array::zeros((10, 10));
let mut cgs = Classical::from_matrix(&a)?;
Loading content...

Implementors

impl GramSchmidt for Classical[src]

fn from_matrix<S>(a: &ArrayBase<S, Ix2>) -> Result<Self> where
    S: Data<Elem = f64>, 
[src]

impl GramSchmidt for Modified[src]

fn from_matrix<S>(a: &ArrayBase<S, Ix2>) -> Result<Self> where
    S: Data<Elem = f64>, 
[src]

impl GramSchmidt for Reorthogonalized[src]

fn from_matrix<S>(a: &ArrayBase<S, Ix2>) -> Result<Self> where
    S: Data<Elem = f64>, 
[src]

Loading content...