# Lua Matrix  wiki

luamatrix provides operations on matrices and vectors whose elements are real, complex, or symbolic. It is implemented entirely in Lua as tables. A complex number data type is also included.

API: A list of functions:

```matrix.add
matrix.columns
matrix.concath
matrix.concatv
matrix.conjugate
matrix.copy
matrix.cross
matrix.det
matrix.div
matrix.divnum
matrix.dogauss
matrix.getelement
matrix.gsub
matrix.invert
matrix.ipairs
matrix.latex
matrix.len
matrix.mul
matrix.mulnum
matrix:new
matrix.normf
matrix.normmax
matrix.pow
matrix.print
matrix.random
matrix.remcomplex
matrix.replace
matrix.root
matrix.rotl
matrix.rotr
matrix.round
matrix.rows
matrix.scalar
matrix.setelement
matrix.size
matrix.solve
matrix.sqrt
matrix.sub
matrix.subm
matrix.tocomplex
matrix.tostring
matrix.tosymbol
matrix.transpose
matrix.type
```

Square root of a matrix  

Tensors 

"Denman–Beavers square root iteration" 

Complex abs 

B = A^(1/p) generalized for integer p > 2 is noted here 

Another approach is in "A new sqrtm for Matlab" ( or ) cited by Octave, though perhaps cannot be extended as well to M^{1/n} for n not equal to 2.

M^x (for matrix M and complex x) is in general defined as expm(logm(M)*x), just like in the real and complex cases. logm and expm  can be understood as Taylor expansions in terms of non-negative integer powers of M (again, analogous to the real and complex cases). Evaluation is discussed in "A Schur-Parlett Algorithm for Computing Matrix Functions" . That is all getting somewhat complicated to (re)implement robustly and perhaps outside the main scope of this module. --DavidManura