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
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
#include <flens/flens.cxx>
#include <iostream>

using namespace flens;
using namespace std;

int
main()
{
    GeMatrix<FullStorage<double> >   A(4,4);
    DenseVector<Array<double> >      x(4), y(4);

    A =  1,  2,  3,  4,
         5,  6,  7,  8,
         9101112,
        13141516;

    x =  1,  2,  3,  4;

    cout << "A = " << A << endl;
    cout << "x = " << x << endl;
    cout << "y = " << y << endl;

    int m = A.numRows();
    int n = A.numCols();

//
//  compute  y = A*x
//
    cxxblas::gemv(m, n, 1.0falsefalse,
                  A.data(), A.strideRow(), A.strideCol(),
                  x.data(), x.stride(),
                  0.0,
                  y.data(), y.stride());

    cout << "y = A*x = " << y << endl;

//
//  compute  y = A^T*x
//
    cxxblas::gemv(m, n, 1.0truefalse,
                  A.data(), A.strideRow(), A.strideCol(),
                  x.data(), x.stride(),
                  0.0,
                  y.data(), y.stride());

    cout << "y = A^T*x = " << y << endl;

//
//  compute  y = 1.5*y + A^T*x
//
    cxxblas::gemv(m, n, 1.0truefalse,
                  A.data(), A.strideRow(), A.strideCol(),
                  x.data(), x.stride(),
                  1.5,
                  y.data(), y.stride());

    cout << "y = 1.5*y + A^T*x = " << y << endl;
}