Hacker News new | past | comments | ask | show | jobs | submit login

The code in the c edition uses 1 for the index origin, via a utility library that provides vectors and matrices that provide Fortran-like indexing.



Page 18 and 19 of the second edition of Numerical Recipes in C [1] support your comment. There is also a discussion on the books forum [2] that suggests that all C editions are 1-based and the current C++ editions are 0-based.

This doesn't fit my recollection of having the C edition with a foreword that described how hard and error prone it was to convert everything from 1-based to 0-based. Maybe my memory plays tricks on me. I'm sure I had the C edition and not the C++ edition and this was before 2000.

[1] http://apps.nrbook.com/c/index.html

[2] http://numerical.recipes/forum/showthread.php?t=65&highlight...


My experience with "NR in C" is 2e. There were a number of routines I wanted to run on data stored in native C arrays, so I painstakingly re-wrote the NR functions to use 0-index single dimension C arrays.


"Besides, the determined Real Programmer can write Fortran programs in any language."

- Ed Post, Real Programmers Don't Use Pascal




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: