M
mma
I have been using the lubksb routine in Visual C++ 6.0 and noticed
what looks like an error to me. The last section of the method looks
like this:
for(i=n;i>=1;i--)
{
sum=b;
for(j=i+1;j<=n;j++)
sum -= a[j]*b[j];
b=sum/a;
}
Where a is an n X n matrix (C array of arrays) which go from 1..n
(through the use of Numerical Recipes offset index method). See page
48 here:
<a href="http://www.library.cornell.edu/nr/bookcpdf/c2-3.pdf">Numerical
Recipes sample pdf</a> for more information.
It appears to me that the inner loop will cause a segmentation fault
because j=i+1 = n+1 which is greater than n--the max index for both a
and b. Yet it seems to work--am I missing something?
--Mike
what looks like an error to me. The last section of the method looks
like this:
for(i=n;i>=1;i--)
{
sum=b;
for(j=i+1;j<=n;j++)
sum -= a[j]*b[j];
b=sum/a;
}
Where a is an n X n matrix (C array of arrays) which go from 1..n
(through the use of Numerical Recipes offset index method). See page
48 here:
<a href="http://www.library.cornell.edu/nr/bookcpdf/c2-3.pdf">Numerical
Recipes sample pdf</a> for more information.
It appears to me that the inner loop will cause a segmentation fault
because j=i+1 = n+1 which is greater than n--the max index for both a
and b. Yet it seems to work--am I missing something?
--Mike