Skip to content

Instantly share code, notes, and snippets.

@drauschenbach
Last active January 16, 2019 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drauschenbach/502b0dd4fff696be0bf030b625d84754 to your computer and use it in GitHub Desktop.
Save drauschenbach/502b0dd4fff696be0bf030b625d84754 to your computer and use it in GitHub Desktop.
Matrices = require 'stuart-ml.linalg.Matrices'
-- Create a dense matrix ((1.0, 2.0), (3.0, 4.0), (5.0, 6.0))
local dm = Matrices.dense(3, 2, {1.0, 3.0, 5.0, 2.0, 4.0, 6.0})
-- Create a sparse matrix ((9.0, 0.0), (0.0, 8.0), (0.0, 6.0))
local sm = Matrices.sparse(3, 2, {0, 1, 3}, {0, 2, 1}, {9, 6, 8})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment