1 #include <iostream>
2 ///
3 /// With header __flens.cxx__ all of FLENS gets included.
4 ///
5 /// :links: __flens.cxx__ -> file:flens/flens.cxx
6 #include <flens/flens.cxx>
7
8 using namespace std;
9 using namespace flens;
10
11 typedef double T;
12
13 int
14 main()
15 {
16 ///
17 /// Define some convenient typedefs for the matrix/vector types
18 /// of our system of linear equations.
19 ///
20 typedef GeMatrix<FullStorage<T, ColMajor> > Matrix;
21 typedef DenseVector<Array<T> > Vector;
22
23 const int n = 5;
24
25 Matrix A(n, n), VL(n, n), VR(n, n);
26 Vector wr(n), wi(n);
27
28
29 A = 2, 3, -1, 0, 2,
30 -6, -5, 0, 2, -6,
31 2, -5, 6, -6, 2,
32 2, 3, -1, 0, 8,
33 -6, -5, 10, 2, -6;
34
35 cerr << "A = " << A << endl;
36
37 ///
38 /// Vector for workspace. If this vector has zero length then
39 /// __lapack::ev__ will do a worksize query and also resize `work`.
40 ///
41 Vector work;
42
43 ///
44 /// You also could do a worksize query manually
45 ///
46 // int optSize = ev_wsq(true, true, A);
47 // Vector work(optSize);
48
49 ///
50 /// Call __lapack::ev__ to compute eigenvalues $w = w_r+i w_i$,
51 /// left eigenvectors $V_L$ and right eigenvectors $V_R$.
52 ///
53 /// :links: __lapack::ev__ -> file:flens/lapack/eig/ev.h
54 lapack::ev(true, true, A, wr, wi, VL, VR, work);
55
56 cerr << "wr = " << wr << endl;
57 cerr << "wi = " << wi << endl;
58 cerr << "VL = " << VL << endl;
59 cerr << "VR = " << VR << endl;
60 }
2 ///
3 /// With header __flens.cxx__ all of FLENS gets included.
4 ///
5 /// :links: __flens.cxx__ -> file:flens/flens.cxx
6 #include <flens/flens.cxx>
7
8 using namespace std;
9 using namespace flens;
10
11 typedef double T;
12
13 int
14 main()
15 {
16 ///
17 /// Define some convenient typedefs for the matrix/vector types
18 /// of our system of linear equations.
19 ///
20 typedef GeMatrix<FullStorage<T, ColMajor> > Matrix;
21 typedef DenseVector<Array<T> > Vector;
22
23 const int n = 5;
24
25 Matrix A(n, n), VL(n, n), VR(n, n);
26 Vector wr(n), wi(n);
27
28
29 A = 2, 3, -1, 0, 2,
30 -6, -5, 0, 2, -6,
31 2, -5, 6, -6, 2,
32 2, 3, -1, 0, 8,
33 -6, -5, 10, 2, -6;
34
35 cerr << "A = " << A << endl;
36
37 ///
38 /// Vector for workspace. If this vector has zero length then
39 /// __lapack::ev__ will do a worksize query and also resize `work`.
40 ///
41 Vector work;
42
43 ///
44 /// You also could do a worksize query manually
45 ///
46 // int optSize = ev_wsq(true, true, A);
47 // Vector work(optSize);
48
49 ///
50 /// Call __lapack::ev__ to compute eigenvalues $w = w_r+i w_i$,
51 /// left eigenvectors $V_L$ and right eigenvectors $V_R$.
52 ///
53 /// :links: __lapack::ev__ -> file:flens/lapack/eig/ev.h
54 lapack::ev(true, true, A, wr, wi, VL, VR, work);
55
56 cerr << "wr = " << wr << endl;
57 cerr << "wi = " << wi << endl;
58 cerr << "VL = " << VL << endl;
59 cerr << "VR = " << VR << endl;
60 }