pub trait Orthogonalizer {
type Elem: Scalar;
// Required methods
fn dim(&self) -> usize;
fn len(&self) -> usize;
fn tolerance(&self) -> <Self::Elem as Scalar>::Real;
fn decompose(
&self,
a: &mut ArrayRef<Self::Elem, Ix1>,
) -> Coefficients<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(
&mut self,
a: &mut ArrayRef<Self::Elem, Ix1>,
) -> AppendResult<Self::Elem>;
fn get_q(&self) -> Q<Self::Elem>;
// Provided methods
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§
fn tolerance(&self) -> <Self::Elem as Scalar>::Real
Sourcefn decompose(
&self,
a: &mut ArrayRef<Self::Elem, Ix1>,
) -> Coefficients<Self::Elem>
fn decompose( &self, a: &mut ArrayRef<Self::Elem, Ix1>, ) -> Coefficients<Self::Elem>
Decompose given vector into the span of current basis and its tangent space
abecomes the tangent vector- The Coefficients to the current basis is returned.
Sourcefn coeff<S>(&self, a: ArrayBase<S, Ix1>) -> Coefficients<Self::Elem>
fn coeff<S>(&self, a: ArrayBase<S, Ix1>) -> Coefficients<Self::Elem>
Calculate the coefficient to the current basis basis
- This will be faster than
decomposebecause the construction of the residual vector may requires more Calculation
Sourcefn append<S>(&mut self, a: ArrayBase<S, Ix1>) -> AppendResult<Self::Elem>
fn append<S>(&mut self, a: ArrayBase<S, Ix1>) -> AppendResult<Self::Elem>
Add new vector if the residual is larger than relative tolerance
Sourcefn div_append(
&mut self,
a: &mut ArrayRef<Self::Elem, Ix1>,
) -> AppendResult<Self::Elem>
fn div_append( &mut self, a: &mut ArrayRef<Self::Elem, Ix1>, ) -> AppendResult<Self::Elem>
Add new vector if the residual is larger than relative tolerance, and return the residual vector
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.