Skip to content

Commit e4af537

Browse files
committed
Add householder iterative decomposition
1 parent bcfee7b commit e4af537

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

src/krylov/householder.rs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ impl<A: Scalar + Lapack> Householder<A> {
2121
}
2222

2323
/// Take a Reflection `P = I - 2ww^T`
24-
fn fundamental_reflection<S: DataMut<Elem = A>>(&self, k: usize, a: &mut ArrayBase<S, Ix1>) {
24+
fn fundamental_reflection<S>(&self, k: usize, a: &mut ArrayBase<S, Ix1>)
25+
where
26+
S: DataMut<Elem = A>,
27+
{
2528
assert!(k < self.v.len());
2629
assert_eq!(a.len(), self.dim, "Input array size mismaches to the dimension");
2730

@@ -140,3 +143,18 @@ impl<A: Scalar + Lapack> Orthogonalizer for Householder<A> {
140143
a
141144
}
142145
}
146+
147+
/// Online QR decomposition of vectors
148+
pub fn householder<A, S>(
149+
iter: impl Iterator<Item = ArrayBase<S, Ix1>>,
150+
dim: usize,
151+
rtol: A::Real,
152+
strategy: Strategy,
153+
) -> (Q<A>, R<A>)
154+
where
155+
A: Scalar + Lapack,
156+
S: Data<Elem = A>,
157+
{
158+
let h = Householder::new(dim);
159+
qr(iter, h, rtol, strategy)
160+
}

0 commit comments

Comments
 (0)