|
Ublas : |
From: Wenming Yu (xuebuyu_at_[hidden])
Date: 2006-02-22 08:41:06
Hi£¬
But I haven't found subfolder "bindings" in boost/numeric. I use VC
.net.
What's wrong? Thanks.
Wenming Yu
-----Original Message-----
From: ublas-bounces_at_[hidden] [mailto:ublas-bounces_at_[hidden]]
On Behalf Of Karl Meerbergen
Sent: Wednesday, February 22, 2006 9:16 PM
To: ublas mailing list
Subject: Re: [ublas] solving non triangular systems
Hello,
You could use the ublas code, which is easy to use. A bit more
complicated but probably more performant is the use of LAPACK using the
boost-sandbox bindings:
#include <boost/numeric/bindings/lapack/gesv.hpp>
#include <boost/numeric/bindings/traits/ublas_matrix.hpp>
#include <boost/numeric/bindings/traits/ublas_vector2.hpp>
matrix<double, column_major> A(n,n) ; // very important that it is
column_major
vector<double> b(n);
vector<double> x(n);
...
x = b ;
boost::numeric::bindings::lapack::gesv(A,x) ;
Karl
Gunter Winkler wrote:
>On Wednesday 22 February 2006 07:53, asaf david wrote:
>
>
>>say i got a non triangular matrix M and a vector b, and i'd like to find
>>the vector x such that Mx=b. is there any way to perform this ? because
>>appearently there's only solver for triangular matrixes. btw i'm sorry if
>>it has been answered before, i coudlnt find a search option in the
archives
>>
>>
>
>you should use the LU-factorization. The code is like this:
>
>// possibly some more ublas includes here
>#include <boost/numeric/ublas/lu.hpp>
>matrix<double> A(n,n);
>vector<double> b(n);
>vector<double> x(n);
>permutation_matrix P(n);
>
>lu_factorize(A,P);
>x = b;
>lu_substitute(A,P,x);
>
>the x ist the solution of Ax=b.
>
>mfg
>Gunter
>_______________________________________________
>ublas mailing list
>ublas_at_[hidden]
>http://lists.boost.org/mailman/listinfo.cgi/ublas
>
>
>
-- ============================================== Look at our unique training program and Register on-line at http://www.fft.be/?id=35 ---------------------------------------------- Karl Meerbergen Free Field Technologies NEW ADDRESS FROM FEBRUARY 1st ONWARD: Axis Park Louvain-la-Neuve rue Emile Francqui, 1 B-1435 Mont-Saint Guibert - BELGIUM Company Phone: +32 10 45 12 26 Company Fax: +32 10 45 46 26 Mobile Phone: +32 474 26 66 59 Home Phone: +32 2 306 38 10 mailto:Karl.Meerbergen_at_[hidden] http://www.fft.be ============================================ _______________________________________________ ublas mailing list ublas_at_[hidden] http://lists.boost.org/mailman/listinfo.cgi/ublas