OON: Usefulness (or otherwise) of valarray for numerical work in C++

From: Michael Hopkins (mhopkins@netmatters.co.uk)
Date: Mon Jun 19 2000 - 05:57:25 EST


Hi all,

I've been sending questions to various maths & C++ lists but now I may
have found the right place to go! Here is a copy of a recent post;
I'm very interested on any thoughts.

Please feel free to CC me directly as well.

Thanks,

Michael Hopkins

----------------------------------------------------------------------

I am canvassing opinion on the usefulness (or otherwise) of the STL
‘valarray’ for high-performance numerical work in C++. I’m deciding
whether to move my library of numerical algorithms (linear algebra,
simulation, global optimisation, Bayesian methods) from C to C++, as I
now understand the potential benefits of an OO approach.

However, there do seem to be alternatives (Objective-C, Eiffel, Java?)
and I’ve heard several complaints about C++ as a working tool; possibly
as a reaction against the inevitable pressure to go with the flow that
surrounds a major new language. I am trying to achieve runtime speed
(mainly for BLAS/LAPACK-style algorithms), clarity of code, ANSI/ISO
compatibility across compilers/platforms & ease of extension. I’m
currently working on the Macintosh which limits the development tools
somewhat, but I’m hoping that OS X will open up a whole bunch of new
UNIX-based stuff that will solve that.

As I see it, valarray was designed by BS exactly for this purpose; to
allow aggressive optimisation by compilers in various ways e.g. because
it is guaranteed to be alias-free. In theory, this should make it
potentially faster than ANSI C until the restrict keyword is
implemented, should it not?

However, there does seem to be a body of (informed?) opinion that
valarray is ‘broken’ or at least not working well enough to be worth the
effort. Does anyone here have experience of the runtime speed of a
carefully constructed (i.e. avoiding the C++ efficiency pitfalls)
valarray-based set of BLAS, LAPACK or whatever? If so, are you using
slices, iterators etc and doing it fully STL-style or doing access with
more traditional Fortran-style (i,j) operators.

Compiler writers; are you taking full advantage of valarray? Does it
offer what it suggests?

Numerical methods people; have you compared it (on a level playing
field) with C, Fortran, C++ template-based libraries (Blitz, MTL,
POOMA)?

Thanks in advance for any thoughts or pointers,

Mike

P.S. Please CC any replies to my email.

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
                                     
     _/_/_/ _/_/_/ _/_/_/ ACS Consultancy
   _/ _/ _/ _/ _/
  _/_/_/_/ _/ _/_/_/ Information Sciences for Industry
 _/ _/ _/ _/
_/ _/ _/_/_/ _/_/_/ Telephone/Fax: 01732~463519 (UK)
                                           
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

     `All models are wrong, but some are useful' - George Box

--------------------- Object Oriented Numerics List --------------------------
* To subscribe/unsubscribe: use the handy web form at
http://oonumerics.org/oon/
* If this doesn't work, please send a note to owner-oon-list@oonumerics.org



This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 03:20:13 EST