Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Practices for scientific programming [closed]

I'd like to write good statements in terms of speed and accuracy. If I remember correctly this line: b=(a+1)*a produces a better program than this: b=(a^2+a).

This is just an example, might be wrong but doesn't matter now, the question is: Where I can find a compendium of good practices for scientific computing?

like image 268
MarcoS Avatar asked Jan 17 '23 16:01

MarcoS


2 Answers

You can look at Numerical Recipes in C. I am not sure if it introduces or teaches you optimization, but it is a very popular book as far as scientific computing in C goes. There may even be a book for C++.

like image 188
Sriram Avatar answered Jan 20 '23 05:01

Sriram


What you are doing here is called premature optimization, and it is the root of many evils. What you should be doing is, writing your programs, then profile them, and try to optimize the critical parts. A full compendium on optimization-techniques for scientific computing will likely be a very thick book, so you need to narrow down your problem before searching for solutions.

like image 45
Björn Pollex Avatar answered Jan 20 '23 05:01

Björn Pollex