lua-matrix
lua-matrix copied to clipboard
matrix({1,2,3,4}) doesn't work
For some very strange reason, vector-to-matrix constructor doesn't work for vectors having more than 3 elements.
Tail elements of the vector (starting with the 4-th) are silently rejected by the current matrix:new() implementation.
hey, there is an easy fix. after line 124 in lua_matrix.lua, replace the next line (line 125) with
local mtx = {}
for i=1,#rows do
mtx[i] = {rows[i]}
end
return setmetatable( mtx, matrix_meta )
also you can write matrix{1,2,3,4...} for short