#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 baby problem ... /// const IndexType n = 4; Matrix A(n,n); Vector b(n); IndexVector piv(n); A = 2, 3, -1, 0, -6, -5, 0, 2, 2, -5, 6, -6, 4, 6, 2, -3; b = 20, -33, -43, 49; cerr << "A = " << A << endl; cerr << "b = " << b << endl; /// /// And solve it with __lapack::sv__ /// /// :links: __lapack::sv__ -> doc:flens/lapack/ge/sv lapack::sv(A, piv, b); cerr << "x = " << b << endl; } |