lua-users home
lua-l archive

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


I think perhaps another approach is warranted for getting the desired speed
up.
What I think should be done is to write, in Lua preferrably, an application
specific compiler to 
compile a strict subset of LUA containing numLua matrix/complex/floating
point expressions into C.

The code would ideally compile some reduced syntax LUA functions into C,
compile them,  link against BLAs and/or Netlib math libraries as well as
NumLUA internal libraries and generate a dynamic library (.dll or .so) that
is then loaded into Lua into a specified table.  Since the current
implementation is dynamically typed (at least for it's matrix type), we
could require some type specifications within a specially formatted comment
field.  

I have used a similar approach to handle certain kinds of Matlab code, and
there are automated Matlab interface generators that do some similar work.
(see h2mex
http://www.mathworks.com/matlabcentral/fileexchange/loadFile.do?objectId=3138&objectType=file
)

The beauty of this approach is that rapid prototyping ala Matlab would still
be available within the LUA interpreter.  After debugging is finished, one
would then launch the NumLua compiler on a file containing LUA routines with
the added annotations.  The end result would (hopefully) be a high speed
version of the routines that were just debugged.
--
View this message in context: http://www.nabble.com/numerical-Lua--t1492383.html#a4274094
Sent from the Lua - General forum at Nabble.com.