I did not introduce other matrix types of FLENS so far. Still the next example uses two more matrix types:
Actually these are
First some notes about triangular matrix views:
About symmetric matrix views:
#include <flens/flens.h>
#include <iostream>
using namespace flens;
using namespace std;
typedef GeMatrix<FullStorage<double, ColMajor> > GEMatrix;
int
main()
{
GEMatrix A(5,5);
A = 1, 2, 3, 4, 5,
6, 7, 8, 9, 0,
9, 7, 5, 3, 1,
0, 9, 1, 8, 2,
7, 3, 6, 4, 5;
GEMatrix::TriangularView U = upper(A);
GEMatrix::TriangularView L = lowerUnit(A);
GEMatrix::SymmetricView SU = upper(A);
GEMatrix::SymmetricView SL = lower(A);
cout << "U = " << U << endl;
cout << "L = " << L << endl;
cout << "SU = " << SU << endl;
cout << "SL = " << SL << endl;
return 0;
}
and here the output
U = [5, 5]
1.000000 2.000000 3.000000 4.000000 5.000000;
0 7.000000 8.000000 9.000000 0.000000;
0 0 5.000000 3.000000 1.000000;
0 0 0 8.000000 2.000000;
0 0 0 0 5.000000;
L = [5, 5]
1 0 0 0 0;
6.000000 1 0 0 0;
9.000000 7.000000 1 0 0;
0.000000 9.000000 1.000000 1 0;
7.000000 3.000000 6.000000 4.000000 1;
SU = [5, 5]
1.000000 2.000000 3.000000 4.000000 5.000000;
2.000000 7.000000 8.000000 9.000000 0.000000;
3.000000 8.000000 5.000000 3.000000 1.000000;
4.000000 9.000000 3.000000 8.000000 2.000000;
5.000000 0.000000 1.000000 2.000000 5.000000;
SL = [5, 5]
1.000000 6.000000 9.000000 0.000000 7.000000;
6.000000 7.000000 7.000000 9.000000 3.000000;
9.000000 7.000000 5.000000 1.000000 6.000000;
0.000000 9.000000 1.000000 8.000000 4.000000;
7.000000 3.000000 6.000000 4.000000 5.000000;