diff options
author | Determinant <[email protected]> | 2015-05-22 10:26:12 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-05-22 10:26:12 +0800 |
commit | 8f18aaba322cf717b8805ebfcacb5a3108d3dda8 (patch) | |
tree | 366b86e2be668da0cf0a7ae430d5d161145b4c16 /matrix/init.lua | |
parent | 7503135d355275a17128f8a4c897739669fcd646 (diff) |
add base class CuMatrix for CuMatrixFloat and CuMatrixDouble
Diffstat (limited to 'matrix/init.lua')
-rw-r--r-- | matrix/init.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/matrix/init.lua b/matrix/init.lua index d6aab73..c33cf7e 100644 --- a/matrix/init.lua +++ b/matrix/init.lua @@ -20,3 +20,15 @@ function nerv.Matrix:__tostring__() table.insert(strt, string.format("[Matrix %d x %d]", nrow, ncol)) return table.concat(strt) end + +function nerv.CuMatrix:__add__(b) + c = self:create() + c:add(self, b, 1.0, 1.0) + return c +end + +function nerv.CuMatrix:__sub__(b) + c = self:create() + c:add(self, b, 1.0, -1.0) + return c +end |