We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 77b6269 commit 0e88d0cCopy full SHA for 0e88d0c
ndarray-linalg/src/eig.rs
@@ -11,6 +11,29 @@ pub trait Eig {
11
type EigVal;
12
type EigVec;
13
/// Calculate eigenvalues with the right eigenvector
14
+ ///
15
+ /// $$ A u_i = \lambda_i u_i $$
16
17
+ /// ```
18
+ /// use ndarray::*;
19
+ /// use ndarray_linalg::*;
20
21
+ /// let a: Array2<f64> = array![
22
+ /// [-1.01, 0.86, -4.60, 3.31, -4.81],
23
+ /// [ 3.98, 0.53, -7.04, 5.29, 3.55],
24
+ /// [ 3.30, 8.26, -3.89, 8.20, -1.51],
25
+ /// [ 4.43, 4.96, -7.66, -7.33, 6.18],
26
+ /// [ 7.31, -6.43, -6.16, 2.47, 5.58],
27
+ /// ];
28
+ /// let (eigs, vecs) = a.eig().unwrap();
29
30
+ /// let a: Array2<c64> = a.map(|v| v.into());
31
+ /// for (&e, vec) in eigs.iter().zip(vecs.axis_iter(Axis(1))) {
32
+ /// let ev = e * vec.into_owned();
33
+ /// let av = a.dot(&vec);
34
+ /// assert_close_l2!(&av, &ev, 1e-5);
35
+ /// }
36
37
fn eig(&self) -> Result<(Self::EigVal, Self::EigVec)>;
38
}
39
0 commit comments