Huang Jianshi wrote:
Hi,
I'm new to Gambit. I read the benchmark and Gambit performs on the top of the list. I want to ask if there is any tutorial/manual/ examples on showing how to write efficient code on number crunching task, especially matrix operations and floating point operations.
Brad Lucier is the main number crunching specialist here. He has some code for matrix operations on his web page (though I don't know how current).
If you want fast handling of single floats (as opposed to vectors or matrices), garbage collection is an issue since floats are normally boxed; you can get around this by using (declare (flonum) (not safe)) in the relevant sections, and/or ##flonum.{*,+,-,/,..} operators. (Floats are still boxed across real function calls, though.)
If you have sparse matrices or want to transparently use multiple cpu's or a cluster without decomposing the work into smaller tasks yourself, the PETSc library may be for you. I did start implementing bindings some time ago but have suspendet that work for now. (I did also plan an infrastructure and did some coding experiments for working with big time series (in disk files) efficiently, but that project has then been cancelled by the customer.)
Christian.