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
#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 DenseVector<Array<T> >              Vector;

    typedef Matrix::IndexType                   IndexType;
    typedef DenseVector<Array<IndexType> >      IndexVector;

    const IndexType n = 4000;

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

    fillRandom(A);
    fillRandom(x);

    b = A*x;

    lapack::sv(A, piv, b);

    b -= x;

    cerr << "blas::asum(diff) = " << blas::asum(b) << endl;
}