1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
#include <cxxstd/iostream.h>
#include <flens/flens.cxx>

using namespace flens;
using namespace std;

int
main()
{
    typedef double                               T;
    typedef DenseVector<Array<T> >               DEVector;
    typedef GeMatrix<FullStorage<T, ColMajor> >  GEMatrix;

    const T  alpha = 1.5,
             beta = 2.5;

    DEVector x(3), y(3), z(3);
    x = 123;
    y = 234;
    z = 345;

    GEMatrix A(3,3);
    A = 123,
        567,
        543;

    ///
    /// Compute $y = \beta y + \alpha A^T x$
    ///
    cxxblas::gemv(A.numRows(), A.numCols(),
                  alpha,
                  truefalse, A.data(), A.strideRow(), A.strideCol(),
                  x.data(), x.stride(),
                  beta,
                  y.data(), y.stride());

    ///
    /// Compute the update $y = y + z$
    ///
    cxxblas::axpy(y.length(), T(1), z.data(), z.stride(), y.data(), y.stride());

    cout << "y = " << y << endl;

    return 0;
}