Click to See Complete Forum and Search --> : fast arithmetic operations


kakalake
March 25th, 2003, 03:46 PM
Hello!
I am going to write a programm that needs to be very fast. I am using many arithmetic operations so i am looking for the fastest way of calculating and best way of transforming my formulars. In addition to that i have an exponential function integrated. I want to know which operations are fast and if they arenīt fast - whatīs the best way to transform them?

Thanks in advance....

Bob Davis
March 27th, 2003, 02:37 PM
You're going to need to be more specific than that. Is the exponential that you need to integrate one with an analytic solution? In this case, you could store the formula that the integral evaluates to and just compute it for specific values. Is it an integral that you need to evaluate numerically? You might have to try to come up with your own integration rule if you're all about speed, possibly a Gauss rule. Or, if accuracy isn't too important, you could just create a lookup table, for even faster access to your data. Your particular application dictates what you're going to want to do. If you need info on numerical computations, I suggest you consult the Numerical Recipes (http://www.library.cornell.edu/nr/nr_index.cgi) books, as they have more mathematical gobbledegook than you'll ever want. Good luck!

dude_1967
March 27th, 2003, 02:52 PM
KK,

I think that Gauss-Legendre integration or some other integration with weighted special functions will, in general, be faster than any type of extended Simpson's rule.

Be specific about the problem as Bob said. Once you have an implementation, there are sometimes some really good optimizations which can be done with clever use of constant tabular data and references. Be sure to never initialize constants more than once.

I found this book very helpful (http://www.amazon.com/exec/obidos/tg/detail/-/0471119636/qid=1048798259/sr=1-3/ref=sr_1_3/102-7186117-6510566?v=glance&s=books). Although written for the FORTRAN77 language, the techniques are explained in a general fashion.

Sincerely, Chris.

:)