Skip to content

Commit 252b70e

Browse files
committed
Move definitions to mod.rs
1 parent 4f004d7 commit 252b70e

File tree

2 files changed

+44
-37
lines changed

2 files changed

+44
-37
lines changed

src/krylov/mgs.rs

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Modified Gram-Schmit orthogonalizer
22
3-
use crate::{generate::*, inner::*, norm::Norm, types::*};
4-
use ndarray::*;
3+
use super::*;
4+
use crate::{generate::*, inner::*, norm::Norm};
55

66
/// Iterative orthogonalizer using modified Gram-Schmit procedure
77
#[derive(Debug, Clone)]
@@ -12,20 +12,6 @@ pub struct MGS<A> {
1212
q: Vec<Array1<A>>,
1313
}
1414

15-
/// Q-matrix
16-
///
17-
/// - Maybe **NOT** square
18-
/// - Unitary for existing columns
19-
///
20-
pub type Q<A> = Array2<A>;
21-
22-
/// R-matrix
23-
///
24-
/// - Maybe **NOT** square
25-
/// - Upper triangle
26-
///
27-
pub type R<A> = Array2<A>;
28-
2915
impl<A: Scalar> MGS<A> {
3016
/// Create an empty orthogonalizer
3117
pub fn new(dimension: usize) -> Self {
@@ -129,27 +115,6 @@ impl<A: Scalar> MGS<A> {
129115
}
130116
}
131117

132-
/// Strategy for linearly dependent vectors appearing in iterative QR decomposition
133-
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
134-
pub enum Strategy {
135-
/// Terminate iteration if dependent vector comes
136-
Terminate,
137-
138-
/// Skip dependent vector
139-
Skip,
140-
141-
/// Orthogonalize dependent vector without adding to Q,
142-
/// i.e. R must be non-square like following:
143-
///
144-
/// ```text
145-
/// x x x x x
146-
/// 0 x x x x
147-
/// 0 0 0 x x
148-
/// 0 0 0 0 x
149-
/// ```
150-
Full,
151-
}
152-
153118
/// Online QR decomposition of vectors using modified Gram-Schmit algorithm
154119
pub fn mgs<A, S>(
155120
iter: impl Iterator<Item = ArrayBase<S, Ix1>>,

src/krylov/mod.rs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,43 @@
1+
//! Krylov subspace
2+
3+
use crate::types::*;
4+
use ndarray::*;
5+
16
pub mod mgs;
7+
8+
pub use mgs::MGS;
9+
10+
/// Q-matrix
11+
///
12+
/// - Maybe **NOT** square
13+
/// - Unitary for existing columns
14+
///
15+
pub type Q<A> = Array2<A>;
16+
17+
/// R-matrix
18+
///
19+
/// - Maybe **NOT** square
20+
/// - Upper triangle
21+
///
22+
pub type R<A> = Array2<A>;
23+
24+
/// Strategy for linearly dependent vectors appearing in iterative QR decomposition
25+
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
26+
pub enum Strategy {
27+
/// Terminate iteration if dependent vector comes
28+
Terminate,
29+
30+
/// Skip dependent vector
31+
Skip,
32+
33+
/// Orthogonalize dependent vector without adding to Q,
34+
/// i.e. R must be non-square like following:
35+
///
36+
/// ```text
37+
/// x x x x x
38+
/// 0 x x x x
39+
/// 0 0 0 x x
40+
/// 0 0 0 0 x
41+
/// ```
42+
Full,
43+
}

0 commit comments

Comments
 (0)