This is the mail archive of the gsl-discuss@sources.redhat.com mailing list for the GSL project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Semi-OT] Tricks of the trade.


Andrea Riciputi writes:
 > I've been using GSL with my own C code for a year or so, I'm quite 
 > satified with them and I've even thought to join GSL development 
 > submitting some piece of code. However, looking at how GSL are written, 
 > I've realized that I ignore many tricks to write good numerical code. 
 > So I'm wondering whether anyone here can give me some good references 
 > about this topics. I really appreciate to improve my knowledge in 
 > writing efficient code.

The GSL design document doc/gsl-design.texi (or at
http://sources.redhat.com/gsl/) has some tips and references to papers
on library design (Vo et al.).

I learned a lot from studying the "GNU C Library Reference Manual", it
has nice examples and is one of the best books published by GNU
(http://www.gnupress.org/)

Be sure to read the "GNU Coding Standards" (standards.texi on
ftp.gnu.org, or at http://www.gnu.org/prep/standards_toc.html) which
also contain a lot of good advice.

For the purely numerical aspects there is a list of my recommended
books at http://www.network-theory.co.uk/bjg/

Another good book not listed there is "Computer Architecture - a
quantitative approach" by Hennessy & Patterson.

In terms of efficiency the key is simply to know the order of
magnitude of the cost of the basic operations (comparison, pointer
dereference, integer operation, floating point operation, function
call, malloc, etc) then it usually becomes obvious how to write
something.  Any processor manual (e.g. Pentium manual from intel.com)
will have the instruction counts for different operations.

Apart from that there are some practical factors, such as the
difficulty of recovering from out-of-memory errors inside a library
function, which determine what the interface should be.

-- 
Brian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]