Boost logo

Ublas :

Subject: Re: [ublas] Help with lu_factorize
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-09-16 03:51:06

On Tue, Sep 15, 2009 at 6:12 PM, Nasos Iliopoulos <nasos_i_at_[hidden]> wrote:
> Marco,
> lu_factorize(A) : A == L*U
> lu_factorize(A2, P) : P*A2 ==L*U
> P is a permutation matrix that interchanges the rows of A2. In some cases a
> matrix cannot be factored, so using pivoting with the permutation matrix can
> give you a factorisation. Also solving a system with and without pivoting
> has some slight differences.
> I hope this helps.

Thanks Nasos!
In effect it seems that both Octave and Mathematica always use LU
decomposition with partial pivoting.
I've found a little Octave program luguass.m which implements LU
without pivoting.
It comes from the book:
  Quarteroni et al. "Scientific Computing with MATLAB and Octave" 2nd
edition (2006)
The result is the same one I get from uBlas. :)

For obtaining L and U matrices I would proceed as follows (sorry this
is Matlab/Octave code, hope do you understand):
L = tril(LU,-1) + eye(4)
U = triu(LU)
That is L is the lower-triangular matrix (without the main diagonal)
plus the identity matrix (of order 4) and U is the upper-triangular
And in effect A2==L*U

Is there a better way to obtain them?

Thank you very much!


-- Marco