ACCU Home page ACCU Conference Page
Search Contact us ACCU at Flickr ACCU at GitHib ACCU at Facebook ACCU at Linked-in ACCU at Twitter Skip Navigation

Search in Book Reviews

The ACCU passes on review copies of computer books to its members for them to review. The result is a large, high quality collection of book reviews by programmers, for programmers. Currently there are 1949 reviews in the database and more every month.
Search is a simple string search in either book title or book author. The full text search is a search of the text of the review.
    View all alphabetically
Title:
Numerical Recipes in C++
Author:
Press et al.
ISBN:
0 521 75033 4
Publisher:
Cambridge University Press
Pages:
1002pp
Price:
£45
Reviewer:
Francis Glassborow
Subject:
algorithms
Appeared in:
14-2
This book has one of the most comprehensive license statement that I have ever seen. I have no great argument with the general basis of these except that they make it a poor reference book for professional programmers unless their employers are willing to buy an appropriate commercial license. However the license that you get by purchasing the book as it stands is to my mind unacceptable. Here is the relevant part in full:

You can type programs from this book directly into your computer. In this case, the only kind of license available to you is the free "immediate license" (see below). You are not authorized to transfer or distribute a machine-readable copy to any other person, nor to have any other person type the programs into a computer on your behalf. We do not want to hear bug reports from you if you choose this option, because experience has shown that virtually all reported bugs in such cases are typing errors!

And in the list of licenses we find:

["Immediate License"] If you are the individual owner of a copy of this book and you type one or more of its routines into your computer, we authorize you to use them on that computer for your own personal and noncommercial purposes. You are not authorized to transfer machine-readable copies to any other person, or to use the routines on more than one machine, or to distribute executable programs containing our routines. This is the only free license.

Now read that carefully. Think of all the things that I am not allowed to do. I cannot use any of their code in an article for publication. Strictly speaking I cannot type the code in on one machine and then use it on another (e.g. if I type it in on my main work machine I cannot take that material with me on my laptop). It also means that there is absolutely no purpose in putting this book in a library because a borrower would have no right to test any of the code, nor can you reasonably lend your copy to someone else.

What makes this so draconian is that before you can even use the very simplest program in the book you will need the three specialist header files on which the books main material relies (nr.h, nrutil.h and nrtypes.h). Those headers fill eighteen pages, and most of their source is at least three quarters of the width of the page. Of course any individual program will only rely on small parts of those headers but what with overloading and the degree to which this book uses templates, selecting which parts you need to type in immediately is error prone.

To sum up this issue: there is little point in buying this book unless you are also willing to buy the source code with at least a single screen license (even that explicitly forbids transfer of the source from one machine to another though it does allow you to transfer any resulting non-commercial executable to other machines provided it was compiled on a licensed machine.) I find the book as sold effectively unusable, and barely usable with a single screen license.

Now for some costs. A single screen license for a Windows based machine is $65 (and you do not get quantity discount for the first 50 licenses), and you better forget about machines where one CPU serves more than one screen because even the educational price is $500 ($1400 if non-educational). If you cannot claim educational status a single screen Linux license is $120. My personal feeling is that hiding this kind of cost from potential purchasers of the book is unethical. The true cost of this book is roughly£90 for use on a MS Windows machine, it is closer to£120 for a Linux user.

To give a little perspective, P.J. Plauger's books on the C and C++ Libraries contain constraints on readers using the code without first buying a license but the cost of relevant licenses is about the same as the charge for a single screen license for numerical recipes source code but without any of these restrictions on use for commercial products. Note that P.J. Plauger's code is expertly written library code that most programmers would be happy to use 'out of the box.'

Now a little on the book itself. The first thing I did was to take a close look at the source code. The original code (many years ago) was developed in Fortran in the 1980's (well, it might have been even earlier). As far as I know the code was was semi-automatically converted to C and little seemed to have been done at that stage to rework the code into idiomatic C. A close examination of the code in the current C++ edition shows that a great deal of it is the same as that original C code. The use of classes is minimal and though there is some use of templates (to provide some things in more than a single precision) this has not been followed through. There is nothing in this book to suggest that the authors have any real grasp of modern C++. Each of the three headers on which the source code of this book depends has a using namespace std directive preceding the namespace NR declaration. In other words they hide all their own names in a namespace but expose the whole of namespace std to any file that includes one of their header files. I think that demonstrates that the authors have not absorbed the ethos of modern C++.

The upshot of this is that the book is very demanding of the reader who has to wade through code that is often opaque because of such things as typedefs hidden away in a header file and short uninformative global names. Many algorithms are written for a only one precision though templates would have allowed support for precision of the users choice. Nothing here justifies the extra-ordinary license costs demanded for even the simplest use of the contents. This book is potentially useful as a source of information for many numerical algorithms but the failure of the authors to rework their code seriously degrades its value to the professional programmer and few amateur programmers would find the costs of ownership justifiable.

From the point of view of the technical content this book deserves its reputation as one of the few standard references on the subject of numerical algorithms. With a more enlightened attitude to intellectual property rights coupled with a complete code rewrite I would list this book as one that every professional programmer should have, even at the cover cost of£45. However in view of the IPR issues I would positively recommend that you do NOT have a copy of this book so that there is no possibility that your, or your employer's successful product could be tainted. If you have the book it would be hard to prove that your code was independently developed from the underlying ideas, even winning a legal case would be too expensive to justify fighting it and with this book's published license requirements you would be wide open to legal action. Remember that litigation is a very popular form of employment among those who draw up the kind of licenses that are attached to this book.

By the way, I would lay fairly heavy odds that most owners of this book break the license requirements even if only unintentionally. It would be interesting to see an open source project aimed at providing a high quality C++ implementation of numerical algorithms, perhaps based on something akin to the STL. I am reasonably confident that the authors of this book would have little to offer from the coding perspective.

I would recommend this book for its coverage of numerical algorithms while issuing strong caveats on source code quality. However I most strongly recommend that purchasers of this book be willing to completely re-implement the code from basics both for IPR reasons and for quality.