[comp.lang.c] Num Recipes in C

jdm5548@tamsun.tamu.edu (James Darrell McCauley) (04/06/91)

Numerical Recipes in C is a great book (praise, praise, praise),
but, if any of you have ever tried to use their code, I'll bet
you can guess what really ticks me off about it.... It seems
that FORTRAN programmers wrote the C code 'cause all array indices
start at 1 instead of 0 (zero).

I bought the source from Cambridge, but rarely use it because of
the confusion.  Does anyone have
  1) a filter that will "fix" all of the code (this would probably
     be very difficult to write), or
  2) information on diffs, or
  3) information on a newer release of the code distributed by
     the publisher.

While I'm in the question asking mode, does anyone have code to 
find eigenvalues for nonsymetrical matrices that I could distribute
in a program that I'm writing?  I've seen discussions about the
copyright of the code in Num. Recipes but forgot what the general 
conclusion programmers reached concerning incorporating it
in programs that will be made available to the general public.

(distributing other folks libraries with my program is NOT an
 option.  I'm only looking for source in C (!= FORTRAN) that
 I can easily extract (in case your thinking of mentioning
 some big package that won't allow me to do this).

Email only, please. Thanks.
-- 
James Darrell McCauley (jdm5548@diamond.tamu.edu, jdm5548@tamagen.bitnet)
Spatial Analysis Lab, Department of Agricultural Engineering,
Texas A&M University, College Station, Texas 77843-2117, USA

henry@zoo.toronto.edu (Henry Spencer) (04/06/91)

In article <14227@helios.TAMU.EDU> jdm5548@tamsun.tamu.edu (James Darrell McCauley) writes:
>Numerical Recipes in C is a great book (praise, praise, praise),
>but, if any of you have ever tried to use their code, I'll bet
>you can guess what really ticks me off about it.... It seems
>that FORTRAN programmers wrote the C code ...

No secret about it:  it's a fairly mechanical translation of the original
Numerical Recipes book, which did everything in FORTRAN.  I decided to get
the original, so I could see the code without "benefit" of translation.
-- 
"The stories one hears about putting up | Henry Spencer @ U of Toronto Zoology
SunOS 4.1.1 are all true."  -D. Harrison|  henry@zoo.toronto.edu  utzoo!henry

epiren@rivm.nl (I.A.Kreis) (04/09/91)

The Numerical Recipes in C -book was intended (IMHO) as a text book on
Numerical methods, *not* on C. The `offset one' notation is a mathematical
convention. Speeding up the programs by using pointers or advanced tricks
is a task for the compiler and/or the programmer. The source in the book
is intended for human readers, not for compilers. (though they may accept
it. You are off course free to alter the code (leaving the algorithms 
for what they are), adding your own style and or flavor. Instead of flaming
the compilers/authors of this book, you could have been recoding the program-
ing examples, to fit your specific needs; you will find yourself pleased
by the easy to read *algorithmical* part of the code. Use your anger 
productively !

Adriaan van Kessel
epiren@rivm.nl

john@newave.UUCP (John A. Weeks III) (04/11/91)

In article <1991Apr6.051923.22033@zoo.toronto.edu> henry@zoo.toronto.edu (Henry Spencer) writes:
> In article <14227@helios.TAMU.EDU> jdm5548@tamsun.tamu.edu (James Darrell McCauley) writes:
> > Numerical Recipes in C is a great book (praise, praise, praise), but,

> No secret about it:  it's a fairly mechanical translation of the original
> Numerical Recipes book, which did everything in FORTRAN.  I decided to get
> the original, so I could see the code without "benefit" of translation.

I once had the opportunity to supervise someone who learned to program
in C from the Numerical Recipes in C book.  Needless to say, that style
is not a very good introduction to C.  I use Numerical Recipes more as
a reference guide than as a source of plug in code.

-john-

-- 
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
John A. Weeks III               (612) 942-6969             john@newave.mn.org
NeWave Communications                       ...uunet!tcnet!wd0gol!newave!john