Are there any scientific packages for Lua comparable to Scipy?
6 Answers
You should try Torch7 (github).
Torch7 has a very nice and efficient vector/matrix/tensor numerical library with a Lua front-end. It also has a bunch of functions for computer vision and machine learning.
It's pretty recent but getting better quickly.

- 54,264
- 27
- 148
- 161

- 121
- 1
- 2
-
1While Torch7 is for general use, currently most of the work has been done for neural networks. Also, while it does support gnuplot, there isn't anything like matplotlib for it. I use Torch7, but still go back to Python for analysis and plotting. Hopefully that can change. – Abe Schneider Jun 24 '12 at 05:58
-
1Also not officially supported on Windows? – Ahmed Fasih Jun 29 '13 at 02:30
-
there is https://github.com/facebook/iTorch which uses ipython plotting backed – Robert Zaremba Feb 28 '15 at 00:25
One can always use Lunatic Python and access scipy inside lua.
> require("python")
> numpy = python.import("numpy")
> numpy.array ... etc ..

- 217,122
- 57
- 293
- 297
-
And also, you could try [lutorpy](https://github.com/imodpasteur/lutorpy) for converting between lua/torch and numpy array, so you can use scipy with torch. – Wei May 30 '16 at 08:53
You have some options:
- Numeric Lua - C module for Lua 5.1/5.2, provides matrices, FFT, complex numbers and others
- GSL Shell - Modification of Lua (supports Lua libraries) with a nice syntax. Provides almost everything that Numeric Lua does, plus ODE solvers, plotting capabilities, and other nice things. Has a great documentation.
- SciLua - Pure LuaJIT module. Aims to be a complete framework for scientific computing in Lua. Provides vectors and matrices, random numbers / distributions, optimization, others. Still in early development.
- Lua Numerical Algorithms - Pure LuaJIT module (uses blas/lapack via LuaJIT FFI). Provides matrices / linear algebra, FFT, complex numbers, optimization algorithms, ODE solver, basic statistics (+ PCA, LDA), and others. Still in early development, but has a somewhat complete documentation and test suits.
There is the basis for one in Numeric Lua.

- 40,708
- 1
- 95
- 119
-
-
I wrote a Lua wrapper for Dislin for Lua 5.1, but there are probably better options today. A Google search for "lua plot" shows a few options: [lua-gnuplot](https://luarocks.org/modules/luarocks/lua-gnuplot), [Torch](http://www.lighting-torch.com/2015/08/24/plotting-with-torch7/), and [lua_flot](http://stevedonovan.github.io/lua-flot/flot-lua.html). – Doug Currie Oct 04 '17 at 14:50
I'm not sure if it is comparable to Scipy, but there is GSL Shell which is based on LuaJIT and GNU Scientific Library, which offers many numerical algorithms and vector/matrix linear algebra operations.

- 16,375
- 3
- 47
- 62
There's a Numpy-like extension for Lua which runs without dependencies at
https://github.com/jzrake/lunum
In the future it will provide FFT's and linear algebra like Numpy+Scipy. Presently it supports numeric array manipulation like in Numpy.

- 603
- 6
- 9