aboutsummaryrefslogtreecommitdiff
path: root/nerv/lib/matrix/generic/cumatrix.c
diff options
context:
space:
mode:
authortxh18 <cloudygooseg@gmail.com>2015-10-27 16:24:55 +0800
committertxh18 <cloudygooseg@gmail.com>2015-10-27 16:24:55 +0800
commit7c95640c95f1cc1d84b4d49fa97fd922748b88a7 (patch)
treee78fc611b8768ddf6e9191d597bf667e83b3353b /nerv/lib/matrix/generic/cumatrix.c
parentba8a1c9d5366c22b0b631f26ae1de7c5da2cbaeb (diff)
added update_select_rows for select_linear:update speed-up
Diffstat (limited to 'nerv/lib/matrix/generic/cumatrix.c')
-rw-r--r--nerv/lib/matrix/generic/cumatrix.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/nerv/lib/matrix/generic/cumatrix.c b/nerv/lib/matrix/generic/cumatrix.c
index 770e503..2dc5899 100644
--- a/nerv/lib/matrix/generic/cumatrix.c
+++ b/nerv/lib/matrix/generic/cumatrix.c
@@ -359,6 +359,18 @@ void nerv_matrix_(copy_rows_fromd_by_idx)(Matrix *a, const Matrix *b,
NERV_SET_STATUS(status, NERV_NORMAL, 0);
}
+void nerv_matrix_(update_select_rows)(Matrix *c, const Matrix *a, const Matrix *idx, double alpha, double beta, Status *status) {
+ long nrow = a->nrow;
+ if (idx->nrow != 1)
+ NERV_EXIT_STATUS(status, MAT_IDX_VECTOR_EXP, 0);
+ if (a->ncol != c->ncol)
+ NERV_EXIT_STATUS(status, MAT_MISMATCH_DIM, 0);
+ PROFILE_START
+ cudak_(cuda_update_select_rows)(c, a, idx, alpha, beta);
+ PROFILE_STOP
+ NERV_SET_STATUS(status, NERV_NORMAL, 0);
+}
+
void nerv_matrix_(expand_frm)(Matrix *a, const Matrix *b,
int context, Status *status) {
if (a->nrow != b->nrow)