Skip to content

Instantly share code, notes, and snippets.

View drauschenbach's full-sized avatar

David Rauschenbach drauschenbach

View GitHub Profile
@drauschenbach
drauschenbach / gist:cbff93872d3f52269ccc70972b7c94b8
Created March 25, 2018 20:46
coreos issue-8715 deploy to Heroku
$ git push heroku master
Total 0 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Go app detected
remote: -----> Fetching jq... done
remote: -----> Fetching tq... done
remote: -----> Installing go1.9.4
remote: -----> Fetching go1.9.4.linux-amd64.tar.gz... done
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})
<html>
<body>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/fengari-web@0.1.2/dist/fengari-web.js"></script>
<script type="application/lua" src="https://cdn.jsdelivr.net/npm/lua-stuart@2.0.0-0/stuart.lua"></script>
<script type="application/lua" src="https://cdn.jsdelivr.net/npm/lua-stuart-ml@2.0.1-0/stuart-ml.lua"></script>
<script type="application/lua">
local Matrices = require 'stuart-ml.linalg.Matrices'
local denseMatrix = Matrices.dense(3, 2, {1.0, 3.0, 5.0, 2.0, 4.0, 6.0})
...
eLua# lua /rom/test/ml/Matrices.luo
Press CTRL+Z to exit Lua
Begin test
✓ dense matrix construction
✓ dense matrix construction with wrong dimension
✓ sparse matrix construction
✓ sparse matrix construction with wrong number of elements
✓ index in matrices incorrect input
✓ matrix indexing and updating
✓ toSparse, toDense
print(collectgarbage('count'))
5.30859375
Matrices = require 'stuart-ml.linalg.Matrices'
local dm = Matrices.dense(3, 2, {1.0, 3.0, 5.0, 2.0, 4.0, 6.0})
print(collectgarbage('count'))
6.177734375
$ luarocks install amalg-redis
local moses = require 'moses'
local acc = {}
for _, i in ipairs(moses.range(5,11)) do
acc[#acc+1] = i
end
local result = table.concat(acc, ',')
print(result)
return result
$ lua -lamalg-redis test1.lua
5,6,7,8,9,10,11
$ cat amalg.cache
return {
[ "moses" ] = "L",
}
$ amalg-redis.lua -s test1.lua -o test1-with-dependencies.lua -c
$ wc -l test1-with-dependencies.lua
2913 test1-with-dependencies.lua
$ redis-cli --eval test1-with-dependencies.lua 0,0
"5,6,7,8,9,10,11"