diff options
author | Determinant <[email protected]> | 2015-06-07 21:59:10 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-06-07 21:59:10 +0800 |
commit | 0f30b1a4b5e583cb1df7dbb349c1af4378e41369 (patch) | |
tree | 967c6326b83cda2b92eee5f597dde0e74b071dbb /matrix/init.c | |
parent | 6e720b961f7edac9c3a41affe0ca40dd0ec9fc85 (diff) |
fix minor bugs in cumatrix; clean up part of code
Diffstat (limited to 'matrix/init.c')
-rw-r--r-- | matrix/init.c | 21 |
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); } |