修订版 | ba31ce6dc54d3ccbee39f1fae5413eec07c13712 (tree) |
---|---|
时间 | 2013-01-24 22:41:40 |
作者 | Katsuhiko Nishimra <ktns.87@gmai...> |
Commiter | Katsuhiko Nishimra |
Add the argument that indicates whether the matrix is row/column-major to Dsyrk. #30562
git-svn-id: https://svn.sourceforge.jp/svnroot/molds/trunk@1251 1136aad2-a195-0410-b898-f5ea1d11b9d8
@@ -313,7 +313,7 @@ void Blas::Dsyrk(molds_blas_int n, molds_blas_int k, | ||
313 | 313 | bool isMatrixATransposed = false; |
314 | 314 | bool isLowerTriangularPartMatrixCUsed = false; |
315 | 315 | double alpha = 1.0 , beta = 0.0; |
316 | - this->Dsyrk(n, k, isMatrixATransposed, isLowerTriangularPartMatrixCUsed, alpha, matrixA, beta, matrixC); | |
316 | + this->Dsyrk(n, k, isMatrixAColumnMajor, isMatrixATransposed, isLowerTriangularPartMatrixCUsed, alpha, matrixA, beta, matrixC); | |
317 | 317 | } |
318 | 318 | |
319 | 319 | // matrixC = alpha*matrixA*matrixA^T + beta*matrixC (isMatrixATransposed==false) |
@@ -322,17 +322,19 @@ void Blas::Dsyrk(molds_blas_int n, molds_blas_int k, | ||
322 | 322 | // matrixA: n*k-matrix (isMatrixATransposed==false) or k*n-matrix (isMatrixATransposed==true) |
323 | 323 | // matrixC: n*n-matrix,symmetric (Use the upper triangular part, and copy it to the lower part.) |
324 | 324 | void Blas::Dsyrk(molds_blas_int n, molds_blas_int k, |
325 | + bool isMatrixAColumnMajor, | |
325 | 326 | bool isMatrixATransposed, |
326 | 327 | bool isLowerTriangularPartMatrixCUsed, |
327 | 328 | double alpha, double const* const* matrixA, |
328 | 329 | double beta, double ** matrixC)const{ |
329 | 330 | double* c = &matrixC[0][0]; |
330 | 331 | double* a = const_cast<double*>(&matrixA[0][0]); |
332 | + CBLAS_ORDER orderA = isMatrixAColumnMajor ? CblasColMajor : CblasRowMajor; | |
331 | 333 | CBLAS_UPLO uploC= isLowerTriangularPartMatrixCUsed ? CblasLower : CblasUpper; |
332 | 334 | CBLAS_TRANSPOSE transA= isMatrixATransposed ? CblasTrans : CblasNoTrans; |
333 | 335 | molds_blas_int lda = &matrixA[1][0] - &matrixA[0][0]; |
334 | 336 | molds_blas_int ldc = &matrixC[1][0] - &matrixC[0][0]; |
335 | - cblas_dsyrk(CblasRowMajor, uploC, transA, n, k, alpha, a, lda, beta, c, ldc); | |
337 | + cblas_dsyrk(orderA, uploC, transA, n, k, alpha, a, lda, beta, c, ldc); | |
336 | 338 | #pragma omp parallel for schedule(auto) |
337 | 339 | for(molds_blas_int i=0;i<n;i++){ |
338 | 340 | for(molds_blas_int j=i+1;j<n;j++){ |
@@ -89,6 +89,7 @@ public: | ||
89 | 89 | double const *const* matrixA, |
90 | 90 | double** matrixC)const; |
91 | 91 | void Dsyrk(molds_blas_int n, molds_blas_int k, |
92 | + bool isMatrixAColumnMajor, | |
92 | 93 | bool isMatrixATransposed, |
93 | 94 | bool isLowerTriangularPartMatrixCUsed, |
94 | 95 | double alpha, double const* const* matrixA, |