1 #include <flens/flens.cxx>
2 #include <iostream>
3
4 using namespace flens;
5 using namespace std;
6
7 int
8 main()
9 {
10 typedef double T;
11 typedef DenseVector<Array<T> > DEVector;
12 typedef GeMatrix<FullStorage<T, ColMajor> > GEMatrix;
13
14 const T alpha = 1.5,
15 beta = 2.5;
16
17 DEVector x(3), y(3), z(3);
18 x = 1, 2, 3;
19 y = 2, 3, 4;
20 z = 3, 4, 5;
21
22 GEMatrix A(3,3);
23 A = 1, 2, 3,
24 5, 6, 7,
25 5, 4, 3;
26
27 ///
28 /// Compute $y = \beta y + \alpha A^T x$
29 ///
30 cxxblas::gemv(A.order(), Trans, A.numRows(), A.numCols(),
31 alpha, A.data(), A.leadingDimension(),
32 x.data(), x.stride(),
33 beta,
34 y.data(), y.stride());
35
36 ///
37 /// Compute the update $y = y + z$
38 ///
39 cxxblas::axpy(y.length(), T(1), z.data(), z.stride(), y.data(), y.stride());
40
41 cout << "y = " << y << endl;
42
43 return 0;
44 }
2 #include <iostream>
3
4 using namespace flens;
5 using namespace std;
6
7 int
8 main()
9 {
10 typedef double T;
11 typedef DenseVector<Array<T> > DEVector;
12 typedef GeMatrix<FullStorage<T, ColMajor> > GEMatrix;
13
14 const T alpha = 1.5,
15 beta = 2.5;
16
17 DEVector x(3), y(3), z(3);
18 x = 1, 2, 3;
19 y = 2, 3, 4;
20 z = 3, 4, 5;
21
22 GEMatrix A(3,3);
23 A = 1, 2, 3,
24 5, 6, 7,
25 5, 4, 3;
26
27 ///
28 /// Compute $y = \beta y + \alpha A^T x$
29 ///
30 cxxblas::gemv(A.order(), Trans, A.numRows(), A.numCols(),
31 alpha, A.data(), A.leadingDimension(),
32 x.data(), x.stride(),
33 beta,
34 y.data(), y.stride());
35
36 ///
37 /// Compute the update $y = y + z$
38 ///
39 cxxblas::axpy(y.length(), T(1), z.data(), z.stride(), y.data(), y.stride());
40
41 cout << "y = " << y << endl;
42
43 return 0;
44 }