What are some of the important Scientific Libraries used in Lua programming?

LuaServer Side ProgrammingProgramming

While we know that Lua does a great job when we want to use it as an embedded language, it can also exceed its basic uses and can be used in extreme cases such as Machine Learning and statistical analysis.

There are many scientific libraries that are present in the market for this particular case of making more out of Lua. Let’s explore what these libraries are and what they do.

The first name that comes to my mind when talking about Lua and machine learning in the same sentence is of the Torch project. The torch project is a scientific computing framework with wide support for machine learning algorithms that puts GPUs first. It is easy to use and efficient, thanks to an easy and fast scripting language, LuaJIT, and an underlying C/CUDA implementation.

The key point to note about the Torch project is that it makes use of the LuaJIT which is Lua’s Just-in-Time compiler, which makes it much easier to make use of the vector/matrix/tensor numerical library that it provides.

Another one that one can make use of is the Numeric Lua project. The numeric Lua project is a numerical package for the Lua programming language. It includes support for complex numbers, multidimensional matrices, random number generation, fast Fourier transforms, and special functions. The project contains different routines that are just Lua wrappers of different famous machine learning libraries.

The last one that definitely belongs to this scientific library category is the Lunatic-python project. In this project, we have a two-way communication between Lua and python and hence can make use of the libraries that are present in the python code inside our Lua code and vice-versa.

One simple use-case would look something like this −

require("python")
numpy = python.import("numpy")
numpy.array ... etc ..
Published on 19-Jul-2021 11:24:20