Re: Using the STL for scientific programming
Am 29.09.2011 20:04, schrieb nmm1@cam.ac.uk:
Does anyone use the STL (and I mean the STL, not BOOST) for scientific
programming and, if so, what parts and for what?
I am not talking about incidental use, but where it provides a major
advantage over rolling one's own for the sort of programmer capable
of writing a serious scientific program in a language like C++.
I am not talking about computer science, which can be argued to be
either an engineering discipline or mathematics, but is not a science
in modern usage (i.e. "those branches of study that relate to the
phenomena of the material universe and their laws"), including the
more mathematically solid aspects of the social sciences.
The area I have looked at most closely is its array support, and I
can't see that it provides anything worth bothering with. It is
noteworthy that neither Bjarne's matrix.h nor BOOST make much use
of them.
I am interested in knowing which components and which areas of
scientific programming it actually helps with, if any. I can see
some uses for its associative containers, but haven't studied them
in enough depth to see if they really do provide an advantage.
I'm indeed working with STL components in purely scientific projects
since years. E.g. in a program to compute Franck-Condon factors and
derived values to simulate vibrational spectra of molecules I'm using
associative containers (Often std::map, but arguably most of them are
unordered containers), where I need to use the pre-standard
implementations because I have to support older compiler versions), a
lot of std::vector (internally), std::pair, IO streams for outputs (IO
manipulators), std::exceptions for hard errors, and std::string objects.
Further, I'm taking massively advantage of STL algorithms, including
those from numeric. I can confirm that my matrix class templates and my
mathematical vector templates don't contain or derive from STL
containers and where written by myself to make it easier to write my
analytical expressions. Originally I had several usages of
std::vector<bool> (which is some kind of dynamic bitset), but later
replaced these by boost::dynamic_bitset because it provides the
functionality that I needed. When I would restart a new project with a
C++11 library I would have a lot of good usages for the new random
number library and for the new time components from std::chrono in
addition to unordered containers and std::function or std::tuple.
I still have some usages of std::auto_ptr (but most of them have been
replaced by boost components which are now standard in C++11).
I hope this gave a little impression.
Greetings from Bremen,
Daniel Kr?gler
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]