Based on the LuaJIT Language Toolkit this executable introduces extensions to the LuaJIT syntax for algebra operations.
- algebra expressions constructed via empty bracket
[]indexing - element-wise operations via plain Lua operators (
+-*/^%) - matrix multiplication via
** - matrix exponentiation via
^^ - transposition via
` - efficient implementation minimizes required allocations and loops
- support for assignments
-- Replicate rand_mat_stat from Julia's benchmark suite:localfunctionrandmatstat(t)
localn=5localv, w=alg.vec(t), alg.vec(t)
fori=1,tdolocala, b, c, d=randn(n, n), randn(n, n), randn(n, n), randn(n, n)
localP=alg.join(a..b..c..d)
localQ=alg.join(a..b, c..d)
v[i] =alg.trace((P[]`**P[])^^4) -- Matrix transpose, product and power.w[i] =alg.trace((Q[]`**Q[])^^4) -- Matrix transpose, product and power.endreturnsqrt(stat.var(v))/stat.mean(v), sqrt(stat.var(w))/stat.mean(w)
endThis module is included in the ULua distribution, to install it use:
upkg add sci-lang
Alternatively, manually install this module making sure that all dependencies listed in the require section of __meta.lua are installed as well (dependencies starting with clib_ are standard C dynamic libraries).
Refer to the official documentation.