| 9 | // matrix vector multiplication |
| 10 | template <typename T> |
| 11 | inline void DnMatDnVec( |
| 12 | DeviceBlasHandle& cublas_H, |
| 13 | DeviceDnTen<T>& vecb, const DeviceDnTen<T>& matA, const DeviceDnTen<T>& vecx, const cublasOperation_t trans = CUBLAS_OP_N |
| 14 | ) { |
| 15 | // check the dimension if we define SAFE |
| 16 | #ifdef SAFE_MODE |
| 17 | if(matA.num_dims!=2){ |
| 18 | std::cout<<"the dimension of A is wrong! A dims: "<< matA.num_dims <<std::endl; |
| 19 | return; |
| 20 | } |
| 21 | else if (vecx.num_dims!=1) |
| 22 | { |
| 23 | std::cout<<"the dimension of x is wrong! x dims: "<< vecx.num_dims <<std::endl; |
| 24 | return; |
| 25 | } |
| 26 | else if(vecb.num_dims!=1) |
| 27 | { |
| 28 | std::cout<<"the dimension of b is wrong! b dims: "<< vecb.num_dims <<std::endl; |
| 29 | return; |
| 30 | } |
| 31 | #endif |
| 32 | |
| 33 | const double alpha = 1.0; |
| 34 | const double beta = 0.0; |
| 35 | //TODO: this all convert to double, should change |
| 36 | CHECK_CUBLAS(cublasDgemv(cublas_H.cublas_handle, trans, matA.dimensions[0], matA.dimensions[1], &alpha, matA.vals, matA.dimensions[0], vecx.vals, 1, &beta, vecb.vals, 1) ); |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | // matrix matrix multiplication |
| 41 | template <typename T> |
nothing calls this directly
no outgoing calls
no test coverage detected