aboutsummaryrefslogtreecommitdiff
path: root/nerv/lib/matrix/generic/cumatrix.c
diff options
context:
space:
mode:
authortxh18 <cloudygooseg@gmail.com>2015-12-22 15:53:31 +0800
committertxh18 <cloudygooseg@gmail.com>2015-12-22 15:53:31 +0800
commitc1f31af8ad1513363eb0b3b8626160cfccb45882 (patch)
treef5322b745ec83b5860fe604c9e7d9ab7c93fc40f /nerv/lib/matrix/generic/cumatrix.c
parent7157b942729ace5d351fbb682de52b6a00527ee7 (diff)
added copy_rows_fromd_by_colidx for clearer naming
Diffstat (limited to 'nerv/lib/matrix/generic/cumatrix.c')
-rw-r--r--nerv/lib/matrix/generic/cumatrix.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/nerv/lib/matrix/generic/cumatrix.c b/nerv/lib/matrix/generic/cumatrix.c
index 31d6b06..7582725 100644
--- a/nerv/lib/matrix/generic/cumatrix.c
+++ b/nerv/lib/matrix/generic/cumatrix.c
@@ -393,6 +393,24 @@ void nerv_matrix_(copy_rows_fromd_by_idx)(Matrix *a, const Matrix *b,
NERV_SET_STATUS(status, NERV_NORMAL, 0);
}
+void nerv_matrix_(copy_rows_fromd_by_colidx)(Matrix *a, const Matrix *b,
+ const Matrix *idx, int b_begin, Status *status) {
+ long nrow = a->nrow;
+ if (!(0 <= b_begin && b_begin + nrow <= idx->nrow))
+ NERV_EXIT_STATUS(status, MAT_INVALID_COPY_INTERVAL, 0);
+ if (idx->ncol != 1)
+ NERV_EXIT_STATUS(status, MAT_IDX_VECTOR_EXP, 0);
+ if (a->ncol != b->ncol) {
+ printf("%d %d\n", a->ncol, b->ncol);
+ NERV_EXIT_STATUS(status, MAT_MISMATCH_DIM, 0);
+ }
+ PROFILE_START
+ cudak_(cuda_copy_rows_by_colidx)(b, a, idx, b_begin);
+ PROFILE_STOP
+ NERV_SET_STATUS(status, NERV_NORMAL, 0);
+}
+
+
#ifdef __NERV_FUTURE_CUDA_7
void nerv_matrix_(update_select_rows_by_rowidx)(Matrix *c, const Matrix *a, const Matrix *idx, double alpha, double beta, Status *status) {
long nrow = a->nrow;