diff options
Diffstat (limited to 'matrix/init.c')
-rw-r--r-- | matrix/init.c | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/matrix/init.c b/matrix/init.c deleted file mode 100644 index c29d7e9..0000000 --- a/matrix/init.c +++ /dev/null @@ -1,35 +0,0 @@ -#include "../common.h" -#include "generic/matrix.h" - -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_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 }, - {NULL, NULL} -}; - -void nerv_matrix_init(lua_State *L) { - /* abstract base class: Matrix */ - luaT_newmetatable(L, nerv_matrix_tname, NULL, NULL, NULL, NULL); - luaL_register(L, NULL, matrix_methods); - lua_pop(L, 1); - - /* CuMatrix inherits from Matrix */ - luaT_newmetatable(L, nerv_matrix_cuda_tname, nerv_matrix_tname, - NULL, NULL, NULL); - 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_mmatrix_init(L); - lua_pop(L, 1); -} |