zf1
11-01-2007, 08:07 AM
Hello everybody,
It appears to me that Numerical recipes has a mistake in the ALGORITHM, and in the code, of course in the Toeplitz linear equation solver (chapter 2.8.2). I have noticed it in the second edition. Of course, I do not have the third edition, but it happens that google-books has the right pages :)
The mistake (if confirmed) is still there.
The problem is that vector indeceis run out of vector bounds in eq 2.8.23 and 2.824, for example.
In the second edtion, the corresponding terms with R_{m+1} and R_{-m-1} are out of range of the vector size.
If m reaches its maximum of N-1 than the addressed
components are R_{N} and R_{-N}, but the vector index
is between -(N-1) and (N-1)!
In the third edition, the corresonding terms in 2.8.23 and 2.8.24 look like: R_{m+2} and R_{-m-2}. The difference
is due to shift in the indexing of the vectors, that is all.
Look also at the code of the function. The line which has
comments "compute numerator and denominator for G and H eqs 2.8.24 and 2.8.23". Trace what the maximum value
of n1-m1-1 and n1+m1+1 and you will see that it is out
of range of the vector size.
Well, these are my thoughts. Either I am wrong, and I would like to understand why or since for 15 years nobody noticed/complained/fixed it, the algorithm presented is not
of interest. In the latter case, could someone suggest a different algorithm which is described in details similar to
that presented in the NR book. Or maybe some code which
can be used? I just need to solve many (100) large(1000-2000 size) Toeplitz equations...
Thanks a lot for your help.
ZF
Thanks a lot,
ZF
It appears to me that Numerical recipes has a mistake in the ALGORITHM, and in the code, of course in the Toeplitz linear equation solver (chapter 2.8.2). I have noticed it in the second edition. Of course, I do not have the third edition, but it happens that google-books has the right pages :)
The mistake (if confirmed) is still there.
The problem is that vector indeceis run out of vector bounds in eq 2.8.23 and 2.824, for example.
In the second edtion, the corresponding terms with R_{m+1} and R_{-m-1} are out of range of the vector size.
If m reaches its maximum of N-1 than the addressed
components are R_{N} and R_{-N}, but the vector index
is between -(N-1) and (N-1)!
In the third edition, the corresonding terms in 2.8.23 and 2.8.24 look like: R_{m+2} and R_{-m-2}. The difference
is due to shift in the indexing of the vectors, that is all.
Look also at the code of the function. The line which has
comments "compute numerator and denominator for G and H eqs 2.8.24 and 2.8.23". Trace what the maximum value
of n1-m1-1 and n1+m1+1 and you will see that it is out
of range of the vector size.
Well, these are my thoughts. Either I am wrong, and I would like to understand why or since for 15 years nobody noticed/complained/fixed it, the algorithm presented is not
of interest. In the latter case, could someone suggest a different algorithm which is described in details similar to
that presented in the NR book. Or maybe some code which
can be used? I just need to solve many (100) large(1000-2000 size) Toeplitz equations...
Thanks a lot for your help.
ZF
Thanks a lot,
ZF