Help advance science by making this algorithm faster
(I also posted this at codeguru, so I'm not just spamming all messageboards with it, just select ones )
I'm a chemist who is writing code that is used to calculate the
reflectivity of x-rays from films at the air-water interface. This has
uses in fields such as materials science, nanoscience, and biology. I
personally use it to study a peptide implicated in Alzheimer's disease.
Now, this calculation is relatively fast, until you realize it has to
be performed roughly 10 million times. I have threaded it with OpenMP,
and I use the Intel compiler (which is ~2x faster than MSVC), but I'm
not a professional. If anyone is looking for an interesting project and
is interested in contributing to science (by making the calculation run
faster) I would greatly appreciate it.
I've attached a console program which roughly benchmarks the
calculation. The tunable areas are in mycomplex.h and multilayer.cpp.
The vast majority of the calculation takes place in myrf (or
transparentmyrf), and mkdensity (or mkdensitytrans).
Even a 10% speed increase would be enormously helpful. I've identified
all of the places I can make the variables floats without skewing the
calculation when the numbers are very small, and I've moved all
calculations that are repetitive outside of major loops (I think).
However, I have no concept of cache misses, and things of that nature.
Also, since this really isn't my field, I don't know what tricks people
use to speed up calculations.
If you can improve the speed, I will be more than happy to acknowledge your contribution to the algorithm. Thanks for any help.