Skip to content

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

Description

@Egor-Skriptunoff

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.

Activity

  1. bachp2 commented on Jun 23, 2019

    @bachp2

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions