Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matrix({1,2,3,4}) doesn't work #13

Open
Egor-Skriptunoff opened this issue Jan 4, 2019 · 1 comment
Open

matrix({1,2,3,4}) doesn't work #13

Egor-Skriptunoff opened this issue Jan 4, 2019 · 1 comment

Comments

@Egor-Skriptunoff
Copy link

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.

@bachp2
Copy link

bachp2 commented Jun 23, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants