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 { ... } }
Expand description

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);
}

Required Associated Types

Required Methods

Dimension of input array

Number of cached basis

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.

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

Add new vector if the residual is larger than relative tolerance

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

Get Q-matrix of generated basis

Provided Methods

check if the basis spans entire space

Implementors