Skip to content

Constructors

3uclidian edited this page Dec 30, 2019 · 3 revisions
local matrix = require "lua_matrix"

matrix.new(rows:int, cols:int)

Creates a zero matrix of the given size.

matrix.new(entries:table, rows:int)

Takes the given table and turns it into a matrix with the given amount of rows.

matrix.new(cols:int, entries:table)

Takes the given table and turns it into a matrix with the given amount of columns.

matrix.new(entries:table:table)

Takes a table of tables and turns it into a matrix

matrix.identity(int:size)

Creates a square identity matrix of the given size

matrix.random(rows:int, cols:int)

Creates a random matrix of the given size. All entries will be in the range [-0.5,0.5]