Skip to content

Commit

Permalink
4.12.0 BUG FIX
Browse files Browse the repository at this point in the history
* Major bug found in the .x. operator interfacing xGEMM from BLAS.
Bug triggered an error from input 13 being illegal, corresponding
to a wrong dimension of the out array C(N,M) = A(N,K).B(K,M)
The integer M was passed as leading dimension of C rather than N.
Error appeared only in cases where M != N which was apparently not
tested. My fault (AA).
  • Loading branch information
aamaricci committed Sep 18, 2024
1 parent 4c3e614 commit 47bd759
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/SF_LINALG/linalg_blas.f90
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ subroutine z_matmul(A,B,C,alfa,beta)
if(any(shape(B)/=[K,M]))stop "z_matmul error: B has illegal shape"
if(any(shape(C)/=[N,M]))stop "z_matmul error: C has illegal shape"
!
call ZGEMM('N', 'N', N, M, K, alfa_, A, N, B, K, beta_, C, M)
call ZGEMM('N', 'N', N, M, K, alfa_, A, N, B, K, beta_, C, N)
!
return
end subroutine z_matmul
Expand Down Expand Up @@ -87,7 +87,7 @@ function z_matmul_(A,B) result(C)
if(any(shape(B)/=[K,M]))stop "d_matmul error: B has illegal shape"
if(any(shape(C)/=[N,M]))stop "d_matmul error: C has illegal shape"
!
call ZGEMM('N', 'N', N, M, K, dcmplx(1d0,0d0), A, N, B, K, dcmplx(0d0,0d0), C, M)
call ZGEMM('N', 'N', N, M, K, dcmplx(1d0,0d0), A, N, B, K, dcmplx(0d0,0d0), C, N)
!
return
end function z_matmul_
Expand Down

0 comments on commit 47bd759

Please sign in to comment.