51 template <
typename DataType>
53 cublasHandle_t cublas_handle,
61 cublasOperation_t trans;
92 assert(status == CUBLAS_STATUS_SUCCESS);
127 template <
typename DataType>
129 cublasHandle_t cublas_handle,
132 const DataType alpha,
138 cublasOperation_t trans;
165 m, n, &alpha, A, lda,
168 assert(status == CUBLAS_STATUS_SUCCESS);
202 template <
typename DataType>
204 cublasHandle_t cublas_handle,
212 cublasOperation_t trans;
216 DataType alpha = 1.0;
240 m, n, &alpha, A, lda,
243 assert(status == CUBLAS_STATUS_SUCCESS);
279 template <
typename DataType>
281 cublasHandle_t cublas_handle,
284 const DataType alpha,
295 cublasOperation_t trans;
322 m, n, &alpha, A, lda,
325 assert(status == CUBLAS_STATUS_SUCCESS);
360 template <
typename DataType>
362 cusparseHandle_t cusparse_handle,
363 const DataType* A_data,
375 for (row=0; row < num_rows; ++row)
378 for (index_pointer=A_index_pointer[row];
379 index_pointer < A_index_pointer[row+1];
382 column = A_column_indices[index_pointer];
383 sum += A_data[index_pointer] * b[column];
425 template <
typename DataType>
427 cusparseHandle_t cusparse_handle,
428 const DataType* A_data,
432 const DataType alpha,
446 for (row=0; row < num_rows; ++row)
449 for (index_pointer=A_index_pointer[row];
450 index_pointer < A_index_pointer[row+1];
453 column = A_column_indices[index_pointer];
454 sum += A_data[index_pointer] * b[column];
456 c[row] += alpha * sum;
494 template <
typename DataType>
496 cusparseHandle_t cusparse_handle,
497 const DataType* A_data,
510 for (column=0; column < num_columns; ++column)
515 for (row=0; row < num_rows; ++row)
517 for (index_pointer=A_index_pointer[row];
518 index_pointer < A_index_pointer[row+1];
521 column = A_column_indices[index_pointer];
522 c[column] += A_data[index_pointer] * b[row];
565 template <
typename DataType>
567 cusparseHandle_t cusparse_handle,
568 const DataType* A_data,
572 const DataType alpha,
586 for (row=0; row < num_rows; ++row)
588 for (index_pointer=A_index_pointer[row];
589 index_pointer < A_index_pointer[row+1];
592 column = A_column_indices[index_pointer];
593 c[column] += alpha * A_data[index_pointer] * b[row];
632 template <
typename DataType>
634 cusparseHandle_t cusparse_handle,
635 const DataType* A_data,
648 for (row=0; row < num_rows; ++row)
653 for (column=0; column < num_columns; ++column)
655 for (index_pointer=A_index_pointer[column];
656 index_pointer < A_index_pointer[column+1];
659 row = A_row_indices[index_pointer];
660 c[row] += A_data[index_pointer] * b[column];
703 template <
typename DataType>
705 cusparseHandle_t cusparse_handle,
706 const DataType* A_data,
710 const DataType alpha,
724 for (column=0; column < num_columns; ++column)
726 for (index_pointer=A_index_pointer[column];
727 index_pointer < A_index_pointer[column+1];
730 row = A_row_indices[index_pointer];
731 c[row] += alpha * A_data[index_pointer] * b[column];
769 template <
typename DataType>
771 cusparseHandle_t cusparse_handle,
772 const DataType* A_data,
784 for (column=0; column < num_columns; ++column)
787 for (index_pointer=A_index_pointer[column];
788 index_pointer < A_index_pointer[column+1];
791 row = A_row_indices[index_pointer];
792 sum += A_data[index_pointer] * b[row];
834 template <
typename DataType>
836 cusparseHandle_t cusparse_handle,
837 const DataType* A_data,
841 const DataType alpha,
855 for (column=0; column < num_columns; ++column)
858 for (index_pointer=A_index_pointer[column];
859 index_pointer < A_index_pointer[column+1];
862 row = A_row_indices[index_pointer];
863 sum += A_data[index_pointer] * b[row];
865 c[column] += alpha * sum;
915 template <
typename DataType>
917 cusparseHandle_t cusparse_handle,
918 const DataType* diagonals,
919 const DataType* supdiagonals,
924 for (
IndexType j=0; j < non_zero_size; ++j)
927 matrix[j][j] = diagonals[j];
930 if (j < non_zero_size-1)
933 matrix[j][j+1] = supdiagonals[j];
938 matrix[j+1][j] = supdiagonals[j];
A static class for matrix-vector operations, which are similar to the level-2 operations of the BLAS ...
static void csc_transposed_matvec(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
static void csr_matvec(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_column_indices, const LongIndexType *A_index_pointer, const DataType *b, const LongIndexType num_rows, DataType *c)
Computes where is compressed sparse row (CSR) matrix and is a dense vector. The output is a dense...
static void dense_matvec(cublasHandle_t cublas_handle, const DataType *A, const DataType *b, const LongIndexType num_rows, const LongIndexType num_columns, const FlagType A_is_row_major, DataType *c)
Computes the matrix vector multiplication where is a dense matrix.
static void csc_matvec_plus(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const DataType alpha, const LongIndexType num_rows, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
static void dense_transposed_matvec_plus(cublasHandle_t cublas_handle, const DataType *A, const DataType *b, const DataType alpha, const LongIndexType num_rows, const LongIndexType num_columns, const FlagType A_is_row_major, DataType *c)
Computes where is dense, and is the transpose of the matrix .
static void csc_transposed_matvec_plus(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const DataType alpha, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
static void dense_transposed_matvec(cublasHandle_t cublas_handle, const DataType *A, const DataType *b, const LongIndexType num_rows, const LongIndexType num_columns, const FlagType A_is_row_major, DataType *c)
Computes matrix vector multiplication where is dense, and is the transpose of the matrix .
static void csr_transposed_matvec_plus(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_column_indices, const LongIndexType *A_index_pointer, const DataType *b, const DataType alpha, const LongIndexType num_rows, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse row (CSR) matrix and is a dense vector. The output is a dense...
static void create_band_matrix(cusparseHandle_t cublas_handle, const DataType *diagonals, const DataType *supdiagonals, const IndexType non_zero_size, const FlagType tridiagonal, DataType **matrix)
Creates bi-diagonal or symmetric tri-diagonal matrix from the diagonal array (diagonals) and off-diag...
static void csr_matvec_plus(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_column_indices, const LongIndexType *A_index_pointer, const DataType *b, const DataType alpha, const LongIndexType num_rows, DataType *c)
Computes where is compressed sparse row (CSR) matrix and is a dense vector. The output is a dense...
static void csr_transposed_matvec(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_column_indices, const LongIndexType *A_index_pointer, const DataType *b, const LongIndexType num_rows, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse row (CSR) matrix and is a dense vector. The output is a dense...
static void dense_matvec_plus(cublasHandle_t cublas_handle, const DataType *A, const DataType *b, const DataType alpha, const LongIndexType num_rows, const LongIndexType num_columns, const FlagType A_is_row_major, DataType *c)
Computes the operation where is a dense matrix.
static void csc_matvec(cusparseHandle_t cusparse_handle, const DataType *A_data, const LongIndexType *A_row_indices, const LongIndexType *A_index_pointer, const DataType *b, const LongIndexType num_rows, const LongIndexType num_columns, DataType *c)
Computes where is compressed sparse column (CSC) matrix and is a dense vector. The output is a de...
cublasStatus_t cublasXgemv(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const DataType *alpha, const DataType *A, int lda, const DataType *x, int incx, const DataType *beta, DataType *y, int incy)