1
2 #include <flens/flens.cxx>
3 #include <iostream>
4
5 using namespace flens;
6 using namespace std;
7
8 int
9 main()
10 {
11 typedef double T;
12 typedef DenseVector<Array<T> > DEVector;
13 typedef GeMatrix<FullStorage<T, ColMajor> > GEMatrix;
14
15 DEVector x(3), y(3), z(3);
16 x = 1, 2, 3;
17 y = 2, 3, 4;
18 z = 3, 4, 5;
19
20 GEMatrix A(3,3);
21 A = 1, 2, 3,
22 5, 6, 7,
23 5, 4, 3;
24
25 ///
26 /// We turn on logging of the closure evaluation, i.e. the evaluation
27 /// of linear algebra expressions that are coded through overloaded
28 /// operators.
29 ///
30 verbose::ClosureLog::start("mylogfile");
31
32 ///
33 /// Compute $v = x + (y + z)$ note that this *must not* be evaluated
34 /// as $v = (x + y) + z
35 ///
36 DEVector v = x + (y + z);
37
38 ///
39 /// Compute $z = A (x + y)$ note that this *must not* be evaluated
40 /// as $z = Ax + Ay$.
41 ///
42 z = A*(x+y);
43
44 cout << "x = " << x << endl;
45
46 ///
47 /// Stop logging.
48 ///
49 verbose::ClosureLog::stop();
50
51 return 0;
52 }
2 #include <flens/flens.cxx>
3 #include <iostream>
4
5 using namespace flens;
6 using namespace std;
7
8 int
9 main()
10 {
11 typedef double T;
12 typedef DenseVector<Array<T> > DEVector;
13 typedef GeMatrix<FullStorage<T, ColMajor> > GEMatrix;
14
15 DEVector x(3), y(3), z(3);
16 x = 1, 2, 3;
17 y = 2, 3, 4;
18 z = 3, 4, 5;
19
20 GEMatrix A(3,3);
21 A = 1, 2, 3,
22 5, 6, 7,
23 5, 4, 3;
24
25 ///
26 /// We turn on logging of the closure evaluation, i.e. the evaluation
27 /// of linear algebra expressions that are coded through overloaded
28 /// operators.
29 ///
30 verbose::ClosureLog::start("mylogfile");
31
32 ///
33 /// Compute $v = x + (y + z)$ note that this *must not* be evaluated
34 /// as $v = (x + y) + z
35 ///
36 DEVector v = x + (y + z);
37
38 ///
39 /// Compute $z = A (x + y)$ note that this *must not* be evaluated
40 /// as $z = Ax + Ay$.
41 ///
42 z = A*(x+y);
43
44 cout << "x = " << x << endl;
45
46 ///
47 /// Stop logging.
48 ///
49 verbose::ClosureLog::stop();
50
51 return 0;
52 }