cdiv Subroutine

private subroutine cdiv(Ar, Ai, Br, Bi, Cr, Ci)

Compute the complex quotient of two complex numbers.

Complex division, (CR,CI) = (AR,AI)/(BR,BI)

Revision History

  • 811101 DATE WRITTEN
  • 891214 Prologue converted to Version 4.0 format. (BAB)
  • 900402 Added TYPE section. (WRB)

Arguments

Type IntentOptional Attributes Name
real(kind=wp) :: Ar
real(kind=wp) :: Ai
real(kind=wp) :: Br
real(kind=wp) :: Bi
real(kind=wp) :: Cr
real(kind=wp) :: Ci

Called by

proc~~cdiv~~CalledByGraph proc~cdiv eispack_module::cdiv proc~hqr2 eispack_module::hqr2 proc~hqr2->proc~cdiv proc~rg eispack_module::rg proc~rg->proc~hqr2 proc~compute_eigenvalues_and_eigenvectors eispack_module::compute_eigenvalues_and_eigenvectors proc~compute_eigenvalues_and_eigenvectors->proc~rg proc~compute_real_eigenvalues_and_normalized_eigenvectors eispack_module::compute_real_eigenvalues_and_normalized_eigenvectors proc~compute_real_eigenvalues_and_normalized_eigenvectors->proc~compute_eigenvalues_and_eigenvectors proc~eispack_test eispack_module::eispack_test proc~eispack_test->proc~compute_eigenvalues_and_eigenvectors

Source Code

 subroutine cdiv(Ar, Ai, Br, Bi, Cr, Ci)

    implicit none

    real(wp) :: Ar, Ai, Br, Bi, Cr, Ci

    real(wp) :: s, ars, ais, brs, bis

    s = abs(Br) + abs(Bi)
    ars = Ar/s
    ais = Ai/s
    brs = Br/s
    bis = Bi/s
    s = brs**2 + bis**2
    Cr = (ars*brs + ais*bis)/s
    Ci = (ais*brs - ars*bis)/s

 end subroutine cdiv