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.

http://math.fullerton.edu/mathews/n2003/LUFactorMod.html

I hope this helps.

Best
Nasos

> Date: Tue, 15 Sep 2009 17:46:15 +0200
> From: marco.guazzone@gmail.com
> To: ublas@lists.boost.org
> Subject: [ublas] Help with lu_factorize
>
> 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


Your E-mail and More On-the-Go. Get Windows Live Hotmail Free. Sign up now.