lua-users wiki: Lua Matrix (original) (raw)
![]() |
---|
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.
Download/Web site:
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
User Comments / Notes
Square root of a matrix [1] [2][3]
Tensors [4]
"Denman�Beavers square root iteration" [2]
Complex abs [5]
B = A^(1/p) generalized for integer p > 2 is noted here [6]
Another approach is in "A new sqrtm for Matlab" ([7] or [8]) 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 [9] 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" [10]. That is all getting somewhat complicated to (re)implement robustly and perhaps outside the main scope of this module. --DavidManura
See Also
- [Numeric Lua] - complex numbers, multidimensional matrices, random number generation and special functions, wrappers for Netlib (Fortran) libraries.
- [NumPy] - Python matrix library (compare design)
- Math libraries in LibrariesAndBindings.
RecentChanges · preferences
edit · history
Last edited September 22, 2010 9:47 pm GMT (diff)