> 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.
>From what I understand, valarray is NOT a real member
of STL family because it
isn't enjoying the STL algorithms at all, which is against the fundamental
idea of generic programming. Its intended usage is to operate in
linear algebra expression, rather than in a set of linear algebra APIs(e.g
blas). Expression template is a really a fancy stuff,
and useful for
homework usage, where all the data structures are nothing but a bunch of
dense multi-dimensional arrays. I used to do my homework with blitz and
was quite happy with it except for its rudeness to my compiler. However,
when I'm working on my finite element project now, the design phase told
me that this expression template stuff is not tractable at all within the
context of software design. It's luxary, you never need so much variety of
expression combination, linear algebra has a small set of common usage
pattern which is covered by MTL(matrix template library) quite well. It's
also limited in its functionality if you jump out of the small world of
dense multi-dimensional array within a single process or thread. Therefore
I think valarray or other expression template stuff is not ready for a
realworld complicated application yet. Maybe someday it evolves to such a
sohphisticated level that most of the complicated representation of
mathematical ARRAY(like sparse matrix, element-by-element matrix in
multi-process or multi-thread environment etc) can be treated efficiently
with expressions rather than these ugly APIs we're living with now. But
at this moment we have to figure out the common usage pattern, extract
out the generic algorithm, make our complicated data structure to work
with these algorithms, fortran blas can provide excellent specialization
for those simple data strucure(dense matrix/vector etc). I think MTL did a
nice job, but gcc-2.95 is still not mighty enough to show me its high
performance comparable with fortran blas. And I really think MTL people
should think about extend their functionality into multi-thread world
rather than delve into the messy expression template world.
Xiaowen
--------------------- 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