@@ -23,8 +23,19 @@ pub type Q<A> = Array2<A>;
2323///
2424pub type R < A > = Array2 < A > ;
2525
26+ /// Array type for coefficients to the current basis
27+ ///
28+ /// - The length must be `self.len() + 1`
29+ /// - Last component is the residual norm
30+ ///
31+ pub type Coefficients < A > = Array1 < A > ;
32+
2633/// Trait for creating orthogonal basis from iterator of arrays
2734///
35+ /// Panic
36+ /// -------
37+ /// - if the size of the input array mismatches to the dimension
38+ ///
2839/// Example
2940/// -------
3041///
@@ -64,37 +75,31 @@ pub trait Orthogonalizer {
6475 self . len ( ) == 0
6576 }
6677
67- /// Calculate the coefficient to the given basis and residual norm
78+ /// Decompose given vector into the span of current basis and
79+ /// its tangent space
6880 ///
69- /// - The length of the returned array must be `self.len() + 1`
70- /// - Last component is the residual norm
81+ /// - `a` becomes the tangent vector
82+ /// - The Coefficients to the current basis is returned.
7183 ///
72- /// Panic
73- /// -------
74- /// - if the size of the input array mismatches to the dimension
84+ fn decompose < S > ( & self , a : & mut ArrayBase < S , Ix1 > ) -> Coefficients < Self :: Elem >
85+ where
86+ S : DataMut < Elem = Self :: Elem > ;
87+
88+ /// Calculate the coefficient to the current basis basis
89+ ///
90+ /// - This will be faster than `decompose` because the construction of the residual vector may
91+ /// requires more Calculation
7592 ///
76- fn coeff < S > ( & self , a : ArrayBase < S , Ix1 > ) -> Array1 < Self :: Elem >
93+ fn coeff < S > ( & self , a : ArrayBase < S , Ix1 > ) -> Coefficients < Self :: Elem >
7794 where
7895 S : Data < Elem = Self :: Elem > ;
7996
8097 /// Add new vector if the residual is larger than relative tolerance
81- ///
82- /// Returns
83- /// --------
84- /// Coefficients to the `i`-th Q-vector
85- ///
86- /// - The size of array must be `self.len() + 1`
87- /// - The last element is the residual norm of input vector
88- ///
89- /// Panic
90- /// -------
91- /// - if the size of the input array mismatches to the dimension
92- ///
9398 fn append < S > (
9499 & mut self ,
95100 a : ArrayBase < S , Ix1 > ,
96101 rtol : <Self :: Elem as Scalar >:: Real ,
97- ) -> Result < Array1 < Self :: Elem > , Array1 < Self :: Elem > >
102+ ) -> Result < Coefficients < Self :: Elem > , Coefficients < Self :: Elem > >
98103 where
99104 S : DataMut < Elem = Self :: Elem > ;
100105
0 commit comments