aboutsummaryrefslogtreecommitdiff
path: root/matrix/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'matrix/init.c')
-rw-r--r--matrix/init.c21
1 files changed, 6 insertions, 15 deletions
diff --git a/matrix/init.c b/matrix/init.c
index 7b7f478..c29d7e9 100644
--- a/matrix/init.c
+++ b/matrix/init.c
@@ -5,21 +5,14 @@ const char *nerv_matrix_tname = "nerv.Matrix";
const char *nerv_matrix_cuda_tname = "nerv.CuMatrix";
const char *nerv_matrix_host_tname = "nerv.MMatrix";
-void nerv_matrix_host_float_init(lua_State *L);
-void nerv_matrix_cuda_float_init(lua_State *L);
-void nerv_matrix_host_double_init(lua_State *L);
-void nerv_matrix_cuda_double_init(lua_State *L);
-void nerv_matrix_host_int_init(lua_State *L);
-int print_profile(lua_State *L);
-int clear_profile(lua_State *L);
+void nerv_cumatrix_init(lua_State *L);
+void nerv_mmatrix_init(lua_State *L);
static const luaL_Reg matrix_methods[] = {
{"__tostring__", nerv_error_method_not_implemented },
{"__add__", nerv_error_method_not_implemented },
{"__sub__", nerv_error_method_not_implemented },
{"__mul__", nerv_error_method_not_implemented },
- {"print_profile", print_profile},
- {"clear_profile", clear_profile},
{NULL, NULL}
};
@@ -32,13 +25,11 @@ void nerv_matrix_init(lua_State *L) {
/* CuMatrix inherits from Matrix */
luaT_newmetatable(L, nerv_matrix_cuda_tname, nerv_matrix_tname,
NULL, NULL, NULL);
- nerv_matrix_cuda_float_init(L);
- nerv_matrix_cuda_double_init(L);
-
+ nerv_cumatrix_init(L);
+ lua_pop(L, 1);
/* MMatrix inherits from Matrix */
luaT_newmetatable(L, nerv_matrix_host_tname, nerv_matrix_tname,
NULL, NULL, NULL);
- nerv_matrix_host_float_init(L);
- nerv_matrix_host_double_init(L);
- nerv_matrix_host_int_init(L);
+ nerv_mmatrix_init(L);
+ lua_pop(L, 1);
}