lua-users home
lua-l archive

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


Tom Barta wrote:
> I'm curious if
> anyone has created a basic 'array' or 'vector' C module for Lua
> similar to how Python's numeric libraries work (array elements are a
> single contiguous type, rather than polymorphic objects).

Yes:  http://numlua.luaforge.net/

It is a lapack-based library of multi-dimensional floating-point
arrays (just like numpy).  It works like that:

        require "numlua.matrix"
        x = matrix(2,3,4)
        for k, i, j in x:entries() do x[k][i][j] = k * (i + j) end

The values are stored contiguously, and you can do the usual things
with them.  Now, let's work so that numlua will replace matlab
someday...