1 #include <iostream>
 2 ///
 3 ///  With header __flens.cxx__ all of FLENS gets included.
 4 ///
 5 ///  :links:  __flens.cxx__ -> file:flens/flens.cxx
 6 #include <flens/flens.cxx>
 7 
 8 using namespace std;
 9 using namespace flens;
10 
11 typedef double   T;
12 
13 int
14 main()
15 {
16     ///
17     ///  Define some convenient typedefs for the matrix/vector types
18     ///  of our system of linear equations.
19     ///
20     typedef GeMatrix<FullStorage<T> >           Matrix;
21     typedef DenseVector<Array<T> >              Vector;
22 
23     ///
24     ///  We also need an extra vector type for the pivots.  The type of the
25     ///  pivots is taken for the system matrix.
26     ///
27     typedef Matrix::IndexType                   IndexType;
28     typedef DenseVector<Array<IndexType> >      IndexVector;
29 
30     ///
31     ///  Set up the baby problem ...
32     ///
33     const IndexType n = 4;
34 
35     Matrix         A(n,n);
36     Vector         b(n);
37     IndexVector    piv(n);
38 
39     A =  2,   3,  -1,   0,
40         -6,  -5,   0,   2,
41          2,  -5,   6,  -6,
42          4,   6,   2,  -3;
43 
44     b = 20,
45        -33,
46        -43,
47         49;
48 
49     cerr << "A = " << A << endl;
50     cerr << "b = " << b << endl;
51 
52     ///
53     /// And solve it with __lapack::sv__
54     ///
55     /// :links: __lapack::sv__ -> file:flens/lapack/gesv/sv.h
56     lapack::sv(A, piv, b);
57 
58     cerr << "x = " << b << endl;
59 }
60