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
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
#if defined(__SSE3__)
//#   undef __SSE3__
#endif


#include <cxxstd/iostream.h>
///
///  With header __flens.cxx__ all of FLENS gets included.
///
///  :links:  __flens.cxx__ -> file:flens/flens.cxx



#include <flens/flens.cxx>

using namespace std;
using namespace flens;

typedef double   T;

int
main()
{
    ///
    ///  Define some convenient typedefs for the matrix/vector types
    ///  of our system of linear equations.
    ///
    typedef GeMatrix<FullStorage<T> >           Matrix;
    typedef DenseVector<Array<T> >              Vector;

    ///
    ///  We also need an extra vector type for the pivots.  The type of the
    ///  pivots is taken for the system matrix.
    ///
    typedef Matrix::IndexType                   IndexType;
    typedef DenseVector<Array<IndexType> >      IndexVector;

    ///
    ///  Set up the  problem ...
    ///
    const IndexType n = 4000;

    Matrix         A(n,n);
    Vector         b(n);
    IndexVector    piv(n);

    fillRandom(A);
    fillRandom(b);


    ///
    /// And solve it with __lapack::sv__
    ///
    /// :links: __lapack::sv__ -> doc:flens/lapack/ge/sv
    lapack::sv(A, piv, b);

    Underscore<IndexType> _;

    lapack::sv(A(_(1,2,n),_(1,2,n)), piv(_(1,2,n)), b(_(1,2,n)));
}