aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--nerv/matrix/generic/cumatrix.c10
-rw-r--r--nerv/matrix/init.lua4
2 files changed, 4 insertions, 10 deletions
diff --git a/nerv/matrix/generic/cumatrix.c b/nerv/matrix/generic/cumatrix.c
index 4bdf5f0..ab7f7c4 100644
--- a/nerv/matrix/generic/cumatrix.c
+++ b/nerv/matrix/generic/cumatrix.c
@@ -43,15 +43,6 @@ static int nerv_matrix_(lua_mul)(lua_State *L) {
return 0;
}
-static int nerv_matrix_(lua_create)(lua_State *L) {
- Status status;
- Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname));
- Matrix *b = nerv_matrix_(create)(a->nrow, a->ncol, &status);
- NERV_LUA_CHECK_STATUS(L, status);
- luaT_pushudata(L, b, nerv_matrix_(tname));
- return 1;
-}
-
static int nerv_matrix_(lua_sigmoid)(lua_State *L) {
Status status;
Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname));
@@ -289,7 +280,6 @@ static int nerv_matrix_(lua_scale_rows_by_row)(lua_State *L) {
}
static const luaL_Reg nerv_matrix_(extra_methods)[] = {
- {"create", nerv_matrix_(lua_create)},
{"colsum", nerv_matrix_(lua_colsum)},
{"colsame", nerv_matrix_(lua_colsame)},
{"rowsum", nerv_matrix_(lua_rowsum)},
diff --git a/nerv/matrix/init.lua b/nerv/matrix/init.lua
index f230e9f..ae9b884 100644
--- a/nerv/matrix/init.lua
+++ b/nerv/matrix/init.lua
@@ -45,6 +45,10 @@ function nerv.Matrix:generate(gen)
end
end
+function nerv.Matrix:create()
+ return self.__constructor(self:nrow(), self:ncol())
+end
+
nerv.MMatrixInt.fmt = "%d "
function nerv.CuMatrix:__add__(b)