diff options
author | Determinant <[email protected]> | 2015-05-26 16:59:25 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-05-26 16:59:25 +0800 |
commit | fd389b72623dcb44009076c3819a74a79b6f94be (patch) | |
tree | 037b2c0e2588e7236578bcf35d8bb08412877c5c /matrix/generic/cumatrix.c | |
parent | 565de7961df25daa3fb437bc7aac0303270387bf (diff) |
add add_row for cumatrix
Diffstat (limited to 'matrix/generic/cumatrix.c')
-rw-r--r-- | matrix/generic/cumatrix.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/matrix/generic/cumatrix.c b/matrix/generic/cumatrix.c index 557e4c1..ae57b21 100644 --- a/matrix/generic/cumatrix.c +++ b/matrix/generic/cumatrix.c @@ -126,6 +126,15 @@ static int nerv_matrix_(rowmax)(lua_State *L) { return 1; } + +static int nerv_matrix_(add_row)(lua_State *L) { + Matrix *a = luaT_checkudata(L, 2, nerv_matrix_(tname)); + Matrix *b = luaT_checkudata(L, 1, nerv_matrix_(tname)); + double beta = luaL_checknumber(L, 3); + cudak_(cuda_add_row)(a, b, beta); + return 0; +} + extern const char *MATRIX_CUMATRIX_HOST_TNAME; static int nerv_matrix_(copy_from)(lua_State *L) { Matrix *a = luaT_checkudata(L, 1, nerv_matrix_(tname)); @@ -163,6 +172,8 @@ static const luaL_Reg nerv_matrix_(extra_methods)[] = { {"rowmax", nerv_matrix_(rowmax)}, {"copy_from", nerv_matrix_(copy_from)}, {"copy_to", nerv_matrix_(copy_to)}, + /* in-place calc */ + {"add_row", nerv_matrix_(add_row)}, {NULL, NULL} }; |