Thread View: sci.math.num-analysis
1 messages
1 total messages
Started by Behnam TABATABAI
Mon, 31 Aug 1992 12:51
Bug in Numerical Recipes? (ludcmp)
Author: Behnam TABATABAI
Date: Mon, 31 Aug 1992 12:51
Date: Mon, 31 Aug 1992 12:51
37 lines
1464 bytes
1464 bytes
Hi!
It seems that the function `ludcmp' for LU-decomposition does not work
well. After decomposition of a matrix in the form
( 0 0 2 )
| 0 3 0 |
( 1 0 0 )
the content of the indx-vector is (3,2,3) instead of (3,2,1). The following
is the code for this example:
#include <stdio.h>
main()
{
float **a, d;
int n, *indx;
extern float **matrix();
extern int *ivector();
extern void ludcmp();
a = matrix( 1, 3, 1, 3 );
indx = ivector( 1, 3 );
a[1][1] = 0.0; a[1][2] = 0.0; a[1][3] = 2.0;
a[2][1] = 0.0; a[2][2] = 3.0; a[2][3] = 0.0;
a[3][1] = 1.0; a[3][2] = 0.0; a[3][3] = 0.0;
ludcmp( a, 3, indx, &d );
for ( n = 1; n <= 3; n++ ) printf( "indx[%d] = %d\n", n, indx[n] );
}
Do I make a mistake? Does anybody has an idea?
Thanks in advance!
Behnam
--
Behnam Tabatabai, | e-mail: tab@piis10.joanneum.ac.at
Joanneum Research, Graz, Austria | tabatabai@joanneum.ada.at
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads