Boost logo

Ublas :

Subject: [ublas] LU decomposition: how can I get a unique solution?
From: Pietro.Mele_at_[hidden]
Date: 2009-10-15 07:38:13


I have a problem finding the LU decomposition of a matrix. I want to impose the L diagonal elements to be equal to 1. I included the code, and this is the (wrong?) result:

Initial matrix:
4 3
6 3

*** Expected result (found with pen and paper): ***

L matrix:
1    0
1.5  1

U matrix:
4   3
0  -1.5

Inverse matrix:
 -0.5  0.5
  1   -2/3

*** Matrices returned by ublas/lu.hpp: ***

lu_factorize A:
4   3/4
6   -3/2

L matrix:
1  0
6  1

U matrix:
4   3/4
0  -3/2

Inverse matrix:
 -0.5  0.5
  1   -2/3

So the inverse matrices are the same, but the L and U matrices used to find them are different (I got them from the lu factorized initial matrix). Who's right? Ublas or my pen?

With "ublas/lu.hpp" how can I specify the values of the diagonal elements needed to obtain a unique solution (i.e. unique L and U matrices)?

Thank you for any help.

Pietro


Boost 1.40.0
O.S.:  Linux (RedHat)
gcc:  3.4.6
kernel:  2.6.9-55.ELsmp

Tags: ublas, lu.hpp, lu decomposition, boost, matrix




Pietro Mele
CFD Software Developer
T. +44 1235 777700
F. +44 1235 764705
attwilliams.com
____________________

Williams Grand Prix Engineering Limited. Registered in England no. 1297497. VAT no. GB292559325. This email is confidential. If you are not the addressee, please contact us by reply.