Codes

Haskell

by: Takayuki Muranushi ()

Haskell implementation
Integration Scheme: 2nd order predictor corrector leapfrog
Compiler: g++4.6.1 with -O4 , ghc 7.0.3 with --make -O3
Operating System: Arch Linux
Hardware:  Intel(R) Core(TM) i7 CPU         975  @ 3.33GHz
Initial Conditions: input/input128 and input/input256
Time step: constant and shared 1.e-3 N-body unit

tEnd = 1.0, file = input/input128

source             tCPU(s) dE/E
main.cpp           0.303    1.7273e-6
MainUnboxed.hs     6.780    2.1276e-6
Main.hs           12.196    2.1276e-6
MainWithList.hs   55.336    2.1276e-6

tEnd = 1.0, file = input/input256

source             tCPU(s) dE/E
main.cpp           1.206   -6.6877e-4     
MainUnboxed.hs    31.508   -6.6877e-4
Main.hs           49.187   -6.6877e-4
MainWithList.hs  494.682   -6.6877e-4




Note:

Main.hs uses 'vector', an efficient array library of Haskell.
MainUnboxed.hs uses unboxed version of Vector.
MainWithList.hs uses Haskell's list, hope it's more intuitive. 

You may need
> cabal install vector
to compile those codes.

Show sourceSelect a file