# Ublas :

Subject: [ublas] Help with lu_factorize
From: Marco Guazzone (marco.guazzone_at_[hidden])
Date: 2009-09-15 11:46:15

Hello!

I don't understand how the function lu_factorize(A) works (note: only
the version with one parameter, which I think is for LU without
pivoting).
I didn't find any documentation of this function so I've decided to
experiment a bit with it.

I've attached an example.
The input matrix is:
---[snip]---
Input matrix
matrix:
[4,4]((0.55595,0.27469,0.540605,0.798938),(0.108929,0.830123,0.891726,0.895283),(0.948014,0.973234,0.216504,0.883152),(0.023787,0.675382,0.231751,0.450332))
---[/snip]---

In this example I use both lu_factorize(A) and lu_factorize(A,P)
(i.e.,with the permutation matrix).
The last one works perfectly. After call it, A is what I expected
(also verified with Mathematica and Octave).
---[snip]---
LU *with* permutation matrix
res: 0
matrix:
[4,4]((0.948014,0.973234,0.216504,0.883152),(0.114902,0.718296,0.866849,0.793807),(0.586436,-0.412156,0.770916,0.608198),(0.0250914,0.906259,-0.725463,0.150003))
---[/snip]---

The first one instead gives a result that I'm not able to understand.
---[snip]---
LU *without* permutation matrix
res: 0
matrix:
[4,4]((0.55595,0.27469,0.540605,0.798938),(0.195933,0.776302,0.785804,0.738745),(1.70521,0.650299,-1.21635,-0.959614),(0.0427862,0.854859,0.380754,0.150003))
---[/snip]---

NOTE: I'm using Boost 1.40 and GCC 4.4.1. I've compiled with:
\$ g++ -o lu -Wall -Wextra -pedantic -ansi lu.cpp

Can you give me an help, please?

Best,

-- Marco

• text/x-c++src attachment: lu.cpp