lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Dear friends,

I'm glad to announce the first beta release of GSL Shell 2. It took a
long time to prepare but now it is may be ready to be tested so that I
can get may be some feedback.

The new release is based on LuaJIT2 and it brings an impressive
performance benefit in term of execution speed for numeric code.

Leveraging the FFI module I've reimplemented many module using pure
Lua with FFI calls to basic C functions. The result is really very
interesting since I've got performance close to optimized C code in
many (all ?) cases.

The module reimplemented are:
- numerical integration, QNG and QAG (adaptive method)
- ODE integration (only for systems not in array form),
  impelmented methods Runge-Kutta-Fehleberg 4(5) et Prince-Dormand 8(9) order
- non-linear fit, Levemnberg-Marquardt routine
  this last was verified against a subset of the NIST dataset
  (try "dofile('benchmarks/lmfit/nist_test.lua')" )

The modules above use the template system kindly contributed by Steve
Donovan. I've modified it to better fit my needs for GSL Shell but the
essential of how it works remains unchanged.

Otherwise I've completely changed the implementation of matrices and
complex numbers, now I use exclusively the FFI interface. The
advantage is that it is easier to implement and maintain and, more
important, we can let LuaJIT2 compile the code since it seems the the
C API can prevent LuaJIT2 from compiling the code.

I've also reimplemented other modules with the FFI interface, for
examples the modules FFT and bspline and it was much more easier then
writing a binding using the Lua C API.

With respect to version 1 the semantic for arithmetic operations is
improved. Now the multiplication operator correspond to the matrix
multiplication. Even more important you can mix freely scalar, matrix
over real of complex numbers transparently. I've changed also the
semantic of indexing inspired of what is done in numlua.

Another important change is that now I've organized the function in
modules instead of putting everything in the global namespace. I'm
sure many people in this mailing list will appreciate :-)
the side effect is that now GSL shell is really compatible with Lua. I
don't use anymore the LNUM patch, the Lua modules are untouched, the
global namespace is not polluted. The short function syntax is still
available but it can be disabled at compile time.

>From the practical point of view you may want to use gsl shell just
like a more friendly luajit2 shell because it does feature:
- readline support
- if you type an expression the result is always printed directly
- the variable "_" capture the last returned value
- you can use the "use" function to make the functions of a module
visible without really polluting the global namespace.
- the short function syntax which is really handy
- a nice, simple graphical system

Otherwise there is a demo I'm really proud of. It does simulate a
quantum spinless particle in a step potential. You can try it with:


It is impressive the speed that you can have with LuaJIT2 and FFI,
really amazing :-)

You can find the documentation for GSL Shell here:

The Savannah project is at:

You can download from the download page the windows binary:

or a debian package (to be tested):

I hope to have some feedback about this new release but don't be
disappointed if it does not compile on 64bit platforms :-) the problem
is that it seems that LuaJIT2 doesn't treat "size_t" numbers like
normal numbers. They are allocated on the heap and cannot be used as
limits in for loops.

Best regards,