aboutsummaryrefslogtreecommitdiff
path: root/matrix/matrix.c
diff options
context:
space:
mode:
authorDeterminant <[email protected]>2015-05-15 03:13:31 +0800
committerDeterminant <[email protected]>2015-05-15 03:13:31 +0800
commit902faa66e3da52a1a4cf7b1dc7da6e6bf0d47d34 (patch)
treed3c5bad9e01ecc13a510fd552b97b080e70c38ad /matrix/matrix.c
parentd77baabfd42d169c2cf7318b770c1f2547ebe17d (diff)
add cumatrix
Diffstat (limited to 'matrix/matrix.c')
-rw-r--r--matrix/matrix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/matrix/matrix.c b/matrix/matrix.c
index 3a593e5..0e5f75f 100644
--- a/matrix/matrix.c
+++ b/matrix/matrix.c
@@ -5,8 +5,9 @@
#define nerv_float_matrix_(NAME) nerv_float_matrix_host_ ## NAME
#include "generic/matrix.c"
+const char *nerv_float_matrix_(tname) = "nerv.FloatMatrix";
int nerv_float_matrix_(get_elem)(lua_State *L) {
- Matrix *self = luaT_checkudata(L, 1, nerv_float_matrix_tname);
+ Matrix *self = luaT_checkudata(L, 1, nerv_float_matrix_(tname));
int idx = luaL_checkinteger(L, 2);
if (idx < 0 || idx >= self->nmax)
nerv_error(L, "index must be within range [0, %d)", self->nmax);
@@ -15,7 +16,7 @@ int nerv_float_matrix_(get_elem)(lua_State *L) {
}
int nerv_float_matrix_(set_elem)(lua_State *L) {
- Matrix *self = luaT_checkudata(L, 1, nerv_float_matrix_tname);
+ Matrix *self = luaT_checkudata(L, 1, nerv_float_matrix_(tname));
int idx = luaL_checkinteger(L, 2);
float v = luaL_checknumber(L, 3);
long upper = self->nrow * self->ncol;