Boost logo

Boost Users :

From: Angus Leeming (angus.leeming_at_[hidden])
Date: 2004-04-08 09:09:37


Russell Hind wrote:
> Yep, found lu.hpp in CVS. This is what I think I have
>
> matrix<double> X;
> vector<double> y;
>
> These are known and I have created them.
>
> I'm trying to solve
>
> Xa = y
>
> So should I be doing this? (I'm getting compile errors with bcc so
> can't check anything at the moment).
>
> permutation_matrix<size_t> pm(X.size1());
> lu_factorize(X, pm)
> lu_substitute(X, pm, y);
>
> so on the way out of lu_substitute, y will contain the values for a?

Correct. Note that X is modified by the call to lu_factorize and y is
modified by the call to lu_substitute.

> Or am I completely on the wrong track?
>
> If not, is there another way of solving this without using lu_*?

Sure. Use the matrix solution method of your choice. Does the MTL not
interoperate with uBlas?

Matrix solvers aren't anything to do with BLAS and the fact
that they're in uBlas is probably an 'embarassment'. (By which I mean
that they extend the remit of the library beyond its original intent.)

> the initial expression I gave came from re-arranging Xa = y to give
> it in terms of a. I'm currently stuck with 1.30.2 but would like
> to be able to solve this using boost, rather than having to find
> another library.

Well, if matrix X isn't too big, then the lu_ methods are just
what you need.

-- 
Angus

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net