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