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
#include <flens/flens.cxx>

using namespace flens;
using namespace std;

int
main()
{
    typedef TpMatrix<PackedStorage<double> >  RealTpMatrix;
    typedef DenseVector<Array<double> >     RealVector;

    const int n   = 5;
    const int nnz = n*(n+1)/2;


    RealVector  a(nnz);
    fillRandom(a);

    typedef PackedStorageView<double>  PSV;

    RealTpMatrix::View  A(PSV(n, a.data()), Upper);

    cout << "A = " << A << endl;

    A += 2;
    cout << "A = " << A << endl;
}