A*x = b, A - symmetric matrix. How to solve

View: New views
2 Messages — Rating Filter:   Alert me  

A*x = b, A - symmetric matrix. How to solve

by Pisky :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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.

Re: A*x = b, A - symmetric matrix. How to solve

by Gunter Winkler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Pisky schrieb:
> Hello!
>
> I can't solve A*x = b system of linear equations where A is a symmetric
> matrix
>  
Please have a look at the Cholesky example on
http://guwi17.de/ublas/examples/

mfg
Gunter
_______________________________________________
ublas mailing list
ublas@...
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: lists@...