1 ///
 2 ///  We simply include everything of FLENS
 3 ///
 4 #include <flens/flens.cxx>
 5 #include <iostream>
 6 
 7 using namespace flens;
 8 using namespace std;
 9 
10 int
11 main()
12 {
13     ///
14     ///  Typedef for a general matrix with elements of type `double`.
15     ///  Internally elements are stored in *column major* order.
16     ///
17     typedef GeMatrix<FullStorage<double, ColMajor> >  GEMatrix;
18 
19     ///
20     ///  Matrix A gets dynamically allocated and then initialized.
21     ///
22     GEMatrix A(4,4);
23     A = 123,  4,
24         567,  8,
25         987,  6,
26         54320;
27 
28     ///
29     ///  Print the matrix content using output streams:
30     ///
31     cout << "A = " << A << endl;
32 
33     ///
34     ///  We print some information about matrix dimensions and index ranges.
35     ///  You will see that by default in FLENS indices start at 1 (like in
36     ///  Fortran):
37     ///
38     cout << "Dim. of A: " << A.numRows() << " x " << A.numCols() << endl;
39     cout << endl;
40     cout << "Row indices: " << A.firstRow() << ".." << A.lastRow() << endl;
41     cout << endl;
42     cout << "Col indices: " << A.firstCol() << ".." << A.lastCol() << endl;
43     cout << endl;
44 
45     ///
46     /// Also for element access (write) we provide a Fortran-Style interface:
47     ///
48     A(3,2) = 42;
49 
50     ///
51     /// The same for read access:
52     ///
53     cout << "changed element: A(3,2) = " << A(3,2) << endl;
54 
55     cout << endl;
56 
57     cout << "A = " << A << endl;
58 
59     ///
60     /// You also can fill the whole matrix with a new value:
61     ///
62     A = 42;
63 
64     cout << "A = " << A << endl;
65 
66     return 0;
67 }