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

using namespace std;
using namespace flens;

typedef double   T;

int
main()
{
    typedef GeMatrix<FullStorage<T> >           Matrix;
    typedef typename Matrix::IndexType          IndexType;

    Underscore<IndexType> _;

    int m = 10;
    int n = 12;

    Matrix         A(m,n);

    int count = 0;

    for (IndexType j=1; j<=n; ++j) {
        for (IndexType i=1; i<=m; ++i) {
            A(i,j) = ++count;
        }
    }

    cout << "A = " << A << endl;
    cout << A(_(2,2,5),_(3,2,7)) << endl;

    auto A_ = A(_(1,2,5),_(3,2,7));

    Matrix B(A_.numRows(), A_.numCols());

    B = A_;

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