Trait ndarray_linalg::krylov::Orthogonalizer[][src]

pub trait Orthogonalizer {
    type Elem: Scalar;
    fn dim(&self) -> usize;
fn len(&self) -> usize;
fn tolerance(&self) -> <Self::Elem as Scalar>::Real;
fn decompose<S>(
        &self,
        a: &mut ArrayBase<S, Ix1>
    ) -> Coefficients<Self::Elem>
    where
        S: DataMut<Elem = Self::Elem>
;
fn coeff<S>(&self, a: ArrayBase<S, Ix1>) -> Coefficients<Self::Elem>
    where
        S: Data<Elem = Self::Elem>
;
fn append<S>(&mut self, a: ArrayBase<S, Ix1>) -> AppendResult<Self::Elem>
    where
        S: Data<Elem = Self::Elem>
;
fn div_append<S>(
        &mut self,
        a: &mut ArrayBase<S, Ix1>
    ) -> AppendResult<Self::Elem>
    where
        S: DataMut<Elem = Self::Elem>
;
fn get_q(&self) -> Q<Self::Elem>; fn is_full(&self) -> bool { ... }
fn is_empty(&self) -> bool { ... } }

Trait for creating orthogonal basis from iterator of arrays

Panic

  • if the size of the input array mismatches to the dimension

Example

let mut mgs = MGS::new(3, 1e-9);
let coef = mgs.append(array![0.0, 1.0, 0.0]).into_coeff();
close_l2(&coef, &array![1.0], 1e-9);

let coef = mgs.append(array![1.0, 1.0, 0.0]).into_coeff();
close_l2(&coef, &array![1.0, 1.0], 1e-9);

// Fail if the vector is linearly dependent
assert!(mgs.append(array![1.0, 2.0, 0.0]).is_dependent());

// You can get coefficients of dependent vector
if let AppendResult::Dependent(coef) = mgs.append(array![1.0, 2.0, 0.0]) {
    close_l2(&coef, &array![2.0, 1.0, 0.0], 1e-9);
}

Associated Types

Loading content...

Required methods

fn dim(&self) -> usize[src]

Dimension of input array

fn len(&self) -> usize[src]

Number of cached basis

fn tolerance(&self) -> <Self::Elem as Scalar>::Real[src]

fn decompose<S>(&self, a: &mut ArrayBase<S, Ix1>) -> Coefficients<Self::Elem> where
    S: DataMut<Elem = Self::Elem>, 
[src]

Decompose given vector into the span of current basis and its tangent space

  • a becomes the tangent vector
  • The Coefficients to the current basis is returned.

fn coeff<S>(&self, a: ArrayBase<S, Ix1>) -> Coefficients<Self::Elem> where
    S: Data<Elem = Self::Elem>, 
[src]

Calculate the coefficient to the current basis basis

  • This will be faster than decompose because the construction of the residual vector may requires more Calculation

fn append<S>(&mut self, a: ArrayBase<S, Ix1>) -> AppendResult<Self::Elem> where
    S: Data<Elem = Self::Elem>, 
[src]

Add new vector if the residual is larger than relative tolerance

fn div_append<S>(
    &mut self,
    a: &mut ArrayBase<S, Ix1>
) -> AppendResult<Self::Elem> where
    S: DataMut<Elem = Self::Elem>, 
[src]

Add new vector if the residual is larger than relative tolerance, and return the residual vector

fn get_q(&self) -> Q<Self::Elem>[src]

Get Q-matrix of generated basis

Loading content...

Provided methods

fn is_full(&self) -> bool[src]

check if the basis spans entire space

fn is_empty(&self) -> bool[src]

Loading content...

Implementors

impl<A: Scalar + Lapack> Orthogonalizer for Householder<A>[src]

type Elem = A

impl<A: Scalar + Lapack> Orthogonalizer for MGS<A>[src]

type Elem = A

Loading content...