Kalessin Action ― The Never Ending Endeavour ―

地震・火山専門の研究開発員のブログ。あららぎハカセ(理学)。つくばで高いところに行くモノ🛰の中身を作ってます。

Between Creativity and Imitation part 2

The previous story has important implication for programming. If you develop a software, especially for science, you should make it thoroughly.


In order to develop "good code", you need to follow these two simple rule.


a) learn hot to use good resource
b) use debugger

I would like to explain what they mean.

a) learn hot to use good resource

Since the beginning of programming, a lot of codes have been developed. In the history of development, specific part of programming are often required though they are sometimes difficult to make through. Some sets of codes do exist and you are not necessary to use your time to development with complete debugging.


The good sources are commercial software. Such softwares invest substantial amount of money for maintenance of software. The examples are:


On the other hand, a lot of free softwares are available these days in lower computer languages like Fortran, C/C++ etc :

1) Numerical Recipe

I think this is one of the most popular resource for scientists. Currently, old versions are open via on-line. If you load them in your Evernote or Google docs, you can search your purpose programs easily. The custom must save your time.

2) GNU scientific Library

If you calculate so often, GNU science library may be useful because you can call popular functions by the program. If you develop numerical code, speed of your code may affect the capacity of your whole code. However, these program are developed under regulation of speed with continuous check by a lot of people, you are not necessary to worry the quality of the calculation. These are for C, andC++.

3) STL and Boost

STL is abbreviation of "Standard template library". The STL and Boost C++ library provide with procedure to develop specific data structure with essential access to them. If you use the library, you can set up complicated data sets shortly. Currently, STL is included by every compiler while you need to install Boost manually.


Boost C++
http://www.boost.org/

4) Google code

This site is for general purpose of programming. Therefore, I do not know whether you can find for scientific purpose though checking this site must be a good custom. Other web sites of commercial software may be useful:


Matlab central
Mathematica


By the way, simple calculations are possible in http://www.wolframalpha.com/



If you want to calculate eigenvalue problem in C++, some software is available like

Blas(Basic Linear Algebra Subprograms) or LAPAS (Linear Algebra PACKage)
Basic Linear Algebra Subprograms supports calculation sets for linear algebra. LAPAS is extensional set of Blas. Both of libraries has fortran or C/C++ editions.Boost C++ library include Blas library. Other library like Eigen is available.


Other resources may be found:
List of numerical analysis software
List of numerical libraries


b) use debugger

However careful you are for your programming, a lot of bugs must be involved in your program. Moreover, the larger the program become, the more difficult the debugging become. If you use commercial software, built-in debugger may be available. On the other hand, open source debugger is available as open-source. The popular and the best open debugger must be "gdb" or "DDD*1". Both of software supports Fortran and C/C++. They must be useful for scientists.



You should use open sources as much as possible (icon of DDD)


Programming requires the highest originality. On the other hand, you should not depend your works too much. If you can use previous sources, you should use it to avoid mistakes and save your time.


Yes. I should make programming myself. However, if you want to make your originality at the appropriate level in a limited time.

*1:"Triple D"