Skip to content

Commit 8028feb

Browse files
committed
Moc of arnoldi method
1 parent 5be4fa7 commit 8028feb

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

src/krylov/arnoldi.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
use super::Orthogonalizer;
2+
use crate::types::*;
3+
use ndarray::*;
4+
5+
pub struct Arnoldi<S, F, Ortho>
6+
where
7+
S: DataMut,
8+
F: Fn(&mut ArrayBase<S, Ix1>),
9+
Ortho: Orthogonalizer,
10+
{
11+
a: F,
12+
v: ArrayBase<S, Ix1>,
13+
ortho: Ortho,
14+
}
15+
16+
impl<S, F, Ortho> Arnoldi<S, F, Ortho>
17+
where
18+
S: DataMut,
19+
F: Fn(&mut ArrayBase<S, Ix1>),
20+
Ortho: Orthogonalizer,
21+
{
22+
pub fn new(a: F, v: ArrayBase<S, Ix1>, ortho: Ortho) -> Self {
23+
Arnoldi { a, v, ortho }
24+
}
25+
}
26+
27+
impl<A, S, F, Ortho> Iterator for Arnoldi<S, F, Ortho>
28+
where
29+
A: Scalar,
30+
S: DataMut<Elem = A>,
31+
F: Fn(&mut ArrayBase<S, Ix1>),
32+
Ortho: Orthogonalizer<Elem = A>,
33+
{
34+
type Item = (Array2<A>, Array2<A>);
35+
36+
fn next(&mut self) -> Option<Self::Item> {
37+
(self.a)(&mut self.v);
38+
let coef = self.ortho.decompose(&mut self.v);
39+
unimplemented!()
40+
}
41+
}

src/krylov/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use crate::types::*;
44
use ndarray::*;
55

6+
pub mod arnoldi;
67
pub mod householder;
78
pub mod mgs;
89

0 commit comments

Comments
 (0)