From fd389b72623dcb44009076c3819a74a79b6f94be Mon Sep 17 00:00:00 2001 From: Determinant Date: Tue, 26 May 2015 16:59:25 +0800 Subject: add add_row for cumatrix --- matrix/generic/cumatrix.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'matrix/generic/cumatrix.c') 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} }; -- cgit v1.2.3