From e9b8855c894daa4e6749acfe891f68b3ed8ed481 Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 19 May 2015 15:01:38 +0800 Subject: add double precision matrix implementation --- cumatrix_example.lua | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'cumatrix_example.lua') 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()) -- cgit v1.2.3