utility_zgemm_new Subroutine

public subroutine utility_zgemm_new(a, b, c, transa_opt, transb_opt)

Uses

  • proc~~utility_zgemm_new~~UsesGraph proc~utility_zgemm_new utility_zgemm_new module~w90_constants w90_constants proc~utility_zgemm_new->module~w90_constants

Arguments

Type IntentOptional AttributesName
complex(kind=dp), intent(in) :: a(:,:)
complex(kind=dp), intent(in) :: b(:,:)
complex(kind=dp), intent(out) :: c(:,:)
character(len=1), intent(in), optional :: transa_opt
character(len=1), intent(in), optional :: transb_opt

Called by

proc~~utility_zgemm_new~~CalledByGraph proc~utility_zgemm_new utility_zgemm_new proc~utility_zgemmm utility_zgemmm proc~utility_zgemmm->proc~utility_zgemm_new proc~utility_rotate_new utility_rotate_new proc~utility_rotate_new->proc~utility_zgemm_new proc~utility_rotate_diag utility_rotate_diag proc~utility_rotate_diag->proc~utility_zgemm_new proc~spin_get_s spin_get_S proc~spin_get_s->proc~utility_rotate_diag proc~spin_get_moment_k spin_get_moment_k proc~spin_get_moment_k->proc~utility_rotate_diag proc~wham_get_deleig_a wham_get_deleig_a proc~wham_get_deleig_a->proc~utility_rotate_diag proc~spin_get_nk spin_get_nk proc~spin_get_nk->proc~utility_rotate_diag proc~wham_get_jjp_jjm_list wham_get_JJp_JJm_list proc~wham_get_jjp_jjm_list->proc~utility_rotate_new proc~k_path k_path proc~k_path->proc~spin_get_nk proc~gyrotropic_get_k_list gyrotropic_get_k_list proc~gyrotropic_get_k_list->proc~spin_get_s proc~k_slice k_slice proc~k_slice->proc~spin_get_nk proc~berry_get_kubo_k berry_get_kubo_k proc~berry_get_kubo_k->proc~spin_get_nk proc~gyrotropic_main gyrotropic_main proc~gyrotropic_main->proc~gyrotropic_get_k_list proc~berry_main berry_main proc~berry_main->proc~berry_get_kubo_k

Contents

Source Code


Source Code

  subroutine utility_zgemm_new(a, b, c, transa_opt, transb_opt)
    !=============================================================!
    !                                                             !
    ! Return matrix product of complex matrices a and b:          !
    !                                                             !
    !                       C = Op(A) Op(B)                       !
    !                                                             !
    ! transa = 'N'  ==> Op(A) = A                                 !
    ! transa = 'T'  ==> Op(A) = transpose(A)                      !
    ! transa = 'C'  ==> Op(A) = congj(transpose(A))               !
    !                                                             !
    ! similarly for B                                             !
    !                                                             !
    ! Due to the use of assumed shape arrays, this routine is a   !
    ! safer and more general replacement for the above routine    !
    ! utility_zgemm. Consider removing utility_zgemm and using    !
    ! utility_zgemm_new throughout.                               !
    !                                                             !
    !=============================================================!

    use w90_constants, only: cmplx_0, cmplx_1

    implicit none

    complex(kind=dp), intent(in)            :: a(:, :)
    complex(kind=dp), intent(in)            :: b(:, :)
    complex(kind=dp), intent(out)           :: c(:, :)
    character(len=1), intent(in), optional  :: transa_opt
    character(len=1), intent(in), optional  :: transb_opt

    integer          :: m, n, k
    character(len=1) :: transa, transb

    transa = 'N'
    transb = 'N'
    if (present(transa_opt)) transa = transa_opt
    if (present(transb_opt)) transb = transb_opt

    ! m ... number of rows in Op(A) and C
    ! n ... number of columns in Op(B) and C
    ! k ... number of columns in Op(A) resp. rows in Op(B)
    m = size(c, 1)
    n = size(c, 2)

    if (transa /= 'N') then
      k = size(a, 1)
    else
      k = size(a, 2)
    end if

    call zgemm(transa, transb, m, n, k, cmplx_1, a, size(a, 1), b, size(b, 1), cmplx_0, c, m)

  end subroutine utility_zgemm_new