Question about scientific calculations in Python

Siegfried Gonzi siegfried.gonzi at kfunigraz.ac.at
Wed Mar 13 04:40:15 EST 2002


Martin Kaufmann wrote:


> >How much slower? A performance penalty of 100 would be of great concern;
> >a factor of 5 should not mind you (but this is my personal view). Okay,
> >if you have to wait in C or C++ 1 hour then even a factor of 5 is
> >somewhat bothersome.
> 
> Even a factor of 5 is not really nice if you have to run it for
> several hundred times...

[I haven't studied your code, yet].

The speed/tuning problem only emerges when one knows about the speed of
an equivalent code lets say written in C++ or Fortran 90. It is
comprehensive that then one does ask: "What are the reasons for, and why
should I just use the slow one".

But you should re-think your stance. I can assure you, that normally
people are not complaining about speed in
Matlab/IDL/Python/Mathematica/Yorick/Octave,... as long as they do not
compare it to C++ or Fortran 90.

They even write simulations in IDL (whenever you see a high resolution
solar granulation image, it is likely that they did it in IDL; at least
my colleague in front of me). Personally, I think they are in error as
long as they write such stuff in IDL, because it is questionable to make
ones code (more than 1000 lines of code) dependent on one company. 

If you are going to decide whether you should learn C or C++, I want
suggest you to dive in to C++ or Fortran 90 directly (If you are a
scientist I can ssure you that nobody on earth will ever pay you money
that you can show how C works). You should just starting to use valarray
and the like. 

I am not a C++ advocate (nor I am a Fortran 90 junkie, either), but
maybe the following (a little bit biased towards C++) article will help
you during your reasoning-study:

www.amath.washington.edu/~lf/software/CompCPP_F90SciOOP.html


S. Gonzi
[It is lurking to have a look at so called modern programming paradigms,
e.g. "functional programming". But you should stay away from them as
long as you do not know whether it is possible for example to write a
number with a sepcific format to a file. Only to mention one tragedy]



More information about the Python-list mailing list