Hi there!
I am trying to write a short RK4 routine for some numerical calculation. I have written some wrapper functions to call the LAPACK and BLAS functions for some of the steps in my code.
For examples, see the code example.
module helpers
use, intrinsic ::iso_fortran_env, only:dp=>real64
implicit none
private
public zmulmv, zmulmm
contains
! wrapper for ZGEMV
subroutine zmulmv(A, X, Y)
complex(dp), dimension(:,:), intent(in) :: A
complex(dp), dimension(:), intent(in) :: X
complex(dp), dimension(:), intent(out) :: Y
integer :: m, n, incx, incy, lda
character :: transa
complex(dp) :: alpha, beta
lda = size(A,1)
incx = 1
incy = 1
m = size(A,dim=1)
n = size(A,dim=2)
alpha = (1.0d0, 0.0d0)
beta = (1.0d0, 0.0d0)
transa = 'N'
call zgemv(transa, m, n, alpha, A, lda, X, incx, alpha, Y, incy)
end subroutine
! wrapper for ZGEMM
subroutine zmulmm(A, B, C)
complex(dp), dimension(:, :), intent(in) :: A, B
complex(dp), dimension(:, :), intent(out) :: C
integer :: l, m, n, lda, ldb, ldc
character :: transa, transb, transc
complex(dp) :: alpha, beta
alpha=(1.0d0, 0.0d0)
beta=(1.0d0, 0.0d0)
transa = 'N'
transb = 'N'
transc = 'N'
lda = size(A,1)
ldb = size(B,1)
ldc = size(C,1)
l = size(A,1)
n = size(B,1)
m = size(C,1)
call zgemm(transa, transb, l, n, m, alpha, a, lda, b, ldb, beta, c, ldc)
end subroutine
end module helpers
So, for some reason these functions don’t seem to work as expected are failing the matrix-matrix multiplication tests I wrote for them.
What am I missing here?