# Basic LU decomposition problem

*From*: Alan Woodland <ajw05@xxxxxxxxxx>*Date*: Mon, 03 Jul 2006 17:02:56 +0100

I've beens struggling for a while to make my LU decomposition algorithm

work. My implementation is based upon the one outlined in the text

"Numerical Recipes in C++, 2nd edition".

The basic algorithm seems to be working fine, all the rows I would

expect to be there are, however they are permuted (as expected), and

values of the variable indx, i.e. the permutation "vector" are either

incorrect, or my understanding of it is wrong. Hopefuly someone can shed

some light on this problem for me.

I had understood the permutation vector returned by the code in NR to be

a representation of a matrix with just one element per row equal to 1

and the rest 0, i.e the vector

{1, 0, 2}

would represent the matrix

0 1 0

1 0 0

0 0 1

etc.

This indeed appears to be a correct interpretation for many case, but

for some cases, e.g. with the matrix:

4, 8, -10

2, 1, -4

3, -1, 2

the permutation vector is returned as

{2, 2, 2}

which makes no sense to me at all!

My initial assumption was that I'd made a mistake in typing out the

algorithm from NR, but I can't seem to find any mistakes in it now, and

it's still not working how I expected. Clearly under the license of the

code in NR I'm not allowed to post any electronic version of their code,

and I have therfore refrained from doing so. Without pasting code this

question may look like I'm asking the impossible, but really what I'm

looking for is the awnsers to these two questions:

1) Is my interpretation of how the permutation vector should work correct?

2) Has anyone else done the same in the past? It'd be great of someone

can point me in the right direction in terms of correcting this problem!

Thanks,

Alan

.

**Follow-Ups**:**Re: Basic LU decomposition problem***From:*Bill Shortall

**Re: Basic LU decomposition problem***From:*Jeremy Watts

**Re: Basic LU decomposition problem***From:*Jeremy Watts

**Re: Basic LU decomposition problem***From:*Carl Barron

**Re: Basic LU decomposition problem***From:*Peter Spellucci

- Prev by Date:
**Re: Well conditioned problems and stable methods** - Next by Date:
**need some concave functions over a NXN matrix** - Previous by thread:
**Spectral element method code writer question** - Next by thread:
**Re: Basic LU decomposition problem** - Index(es):