Well, without proper definitions for all the types, and without a functions definition for sign(), the code cannot compile, so it cannot be tested.
I looked at the C-Source again
/* in "nrutil.h" */
#define SIGN(a,b) ((b) >= 0.0 ? fabs(a) : -fabs(a))
Huh?
I was always under the impression, a SIGN-Function actually returns the "Sign" in the form of
If arg>0 Then
Result:=1
Else If arg=0 Then
Result:=0
Else IF arg<0 Then
Result:=-1;
Admittedly, THAT Sign-Function takes only one Argument as compared to the Sign-Function used in that Algorithm (2 Arguments), but boy, this looks weird to me.
EDIT: Noticed something else:
His first two loops (Line 8 and 9) looks "wrong" to me
for i := 2 to n do
for j := i-1 to n do
From C-Source
for (i=1;i<=n;i++)
for (j=IMAX(i-1,1);j<=n;j++)
His outer loop starts at 2, the C-Loop starts at 1, nevermind the IMAX in the second loop,
with IMAX being a simple MAX-Macro for Integers
static int imaxarg1,imaxarg2;
#define IMAX(a,b) (imaxarg1=(a),imaxarg2=(b),(imaxarg1) > (imaxarg2) ?\
(imaxarg1) : (imaxarg2))
And his Line 5: What are "TElems"?
In the C-Source those are "Floats"
I'm probably going to take a stab at it porting it to Pascal if i'm not bogged down with other things