summaryrefslogtreecommitdiff
path: root/cumatrix_example.lua
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-19 15:01:38 +0800
committerDeterminant <[email protected]>2015-05-19 15:01:38 +0800
commite9b8855c894daa4e6749acfe891f68b3ed8ed481 (patch)
tree5a3ea5e89bd475dc4312d379ffc7bf9121862dbb /cumatrix_example.lua
parent9b6606504241f27a9d42b96f535bf5f2c2918161 (diff)
add double precision matrix implementation
Diffstat (limited to 'cumatrix_example.lua')
-rw-r--r--cumatrix_example.lua19
1 files changed, 10 insertions, 9 deletions
diff --git a/cumatrix_example.lua b/cumatrix_example.lua
index c2f2139..f26d7f4 100644
--- a/cumatrix_example.lua
+++ b/cumatrix_example.lua
@@ -1,15 +1,16 @@
m = 10
n = 10
-t = nerv.FloatCuMatrix(m, n)
--- print(t)
-a = t[1]
+fm = nerv.FloatCuMatrix(m, n)
+dm = nerv.DoubleCuMatrix(m, n)
for i = 0, m - 1 do
for j = 0, n - 1 do
--- t[i][j] = i + j
- t[i][j] = math.random(10)
+ -- local t = math.random(10)
+ t = i / (j + 1)
+ fm[i][j] = t
+ dm[i][j] = t
end
end
-print(t)
-print(t:colsum())
-print(t:colmax())
-print(t:softmax())
+print(fm)
+print(fm:softmax())
+print(dm)
+print(dm:softmax())