🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: sci.math.num-analysis
Article #387

Bug in Numerical Recipes? (ludcmp)

#387
From: Behnam TABATABAI
Date: Mon, 31 Aug 1992 12:51
37 lines
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
Technical Details
Message-ID: <1992Aug31.125142.8521@news.tu-graz.ac.at>
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!news.tu-graz.ac.at!piis10.joanneum.ac.at!tab

Show Full Headers
Complete Article Headers
Newsgroups: sci.math.num-analysis
Path: arc1-ca.pugleaf.net!sparky!uunet!news.univie.ac.at!news.tu-graz.ac.at!piis10.joanneum.ac.at!tab
From: tab@piis10.joanneum.ac.at (Behnam TABATABAI)
Subject: Bug in Numerical Recipes? (ludcmp)
Message-ID: <1992Aug31.125142.8521@news.tu-graz.ac.at>
Sender: news@news.tu-graz.ac.at (USENET News System)
Nntp-Posting-Host: piis10.joanneum.ac.at
Organization: Joanneum Research, Graz, Austria
X-Newsreader: Tin 1.1 PL5
Date: Mon, 31 Aug 92 12:51:42 GMT
Lines: 37