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
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
#include <flens/flens.cxx>
#include <iostream>

using namespace flens;
using namespace std;

int
main()
{
    GeMatrix<FullStorage<double> >   A(4,4), B(4,4), C(4,4);

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

    B = 17181920,
        21222324,
        25262728,
        29303132;

    auto U = A.upper();
    auto S = A.upper().symmetric();

    cout << "A = " << A << endl;
    cout << "B = " << B << endl;
    cout << "S = " << S << endl;
    cout << "U = " << U << endl;

//
//  compute  C = A*B
//
    cxxblas::gemm(C.numRows(), C.numCols(), A.numCols(),
                  1.0,
                  falsefalse, A.data(), A.strideRow(), A.strideCol(),
                  falsefalse, B.data(), B.strideRow(), B.strideCol(),
                  0.0,
                  C.data(), C.strideRow(), C.strideCol());

    cout << "C = A*B = " << C << endl;

//
//  compute  C = A^T*B
//
    cxxblas::gemm(C.numRows(), C.numCols(), A.numCols(),
                  1.0,
                  true,  false, A.data(), A.strideRow(), A.strideCol(),
                  falsefalse, B.data(), B.strideRow(), B.strideCol(),
                  0.0,
                  C.data(), C.strideRow(), C.strideCol());

    cout << "C = A^T*B = " << C << endl;

//
//  compute  C = S*B
//
    cxxblas::symm(true, C.numRows(), C.numCols(),
                  1.0,
                  (S.upLo()==Lower),
                  S.data(), S.strideRow(), S.strideCol(),
                  B.data(), B.strideRow(), B.strideCol(),
                  0.0,
                  C.data(), C.strideRow(), C.strideCol());

    cout << "C = S*B = " << C << endl;

//
//  compute  B = U*B
//
    cxxblas::trmm(true, C.numRows(), C.numCols(),
                  1.0,
                  (U.upLo()==Lower), falsefalse, (U.diag()==Unit),
                  U.data(), U.strideRow(), U.strideCol(),
                  B.data(), B.strideRow(), B.strideCol());

    cout << "B = U*B = " << B << endl;
}