Boost logo

Ublas :

Subject: [ublas] A*x = b, A - symmetric matrix. How to solve
From: Pisky (thepisky_at_[hidden])
Date: 2009-09-07 16:05:06


Hello!

I can't solve A*x = b system of linear equations where A is a symmetric
matrix

boost::numeric::ublas::symmetric_matrix<double, ublas::lower,
ublas::column_major> A(4,4);

A.clear();

A(0,0) = 1.;
A(1,0) = -1.; A(1,1) = 2.;
A(2,1) = -1.; A(2,2) = 2.;
A(3,2) = -1.; A(3,3) = 1.;

ublas::matrix<double,ublas::column_major> b(4,1);
b(0,0) = -1.; b(1,0) = 0.; b(2,0) = 0.; b(3,0) = 1.;

How can I get the solution?

For the case where A was declared as:
     ublas::matrix<double,ublas::column_major> A(4,4);
     A(0,0) = 1.; A(0,1) = -1.;
     A(1,0) = -1.; A(1,1) = 2.; A(1,2) = -1.;
     A(2,1) = -1.; A(2,2) = 2.; A(2,3) = -1.;
     A(3,2) = -1.; A(3,3) = 1.;
the situation was clear:
     boost::numeric::bindings::lapack::gesv(A,b);

Please help me. I would be grateful.

-- 
View this message in context: http://www.nabble.com/A*x-%3D-b%2C-A---symmetric-matrix.-How-to-solve-tp25335631p25335631.html
Sent from the Boost - uBLAS mailing list archive at Nabble.com.