utility_inv2 Subroutine

public subroutine utility_inv2(a, b, det)

Return in b the adjoint of the 2x2 matrix a, together with the determinant of a. The inverse is defined as the adjoind divided by the determinant, so that inverse(a) = b/det

Arguments

Type IntentOptional AttributesName
real(kind=dp), intent(in) :: a(2,2)
real(kind=dp), intent(out) :: b(2,2)
real(kind=dp), intent(out) :: det

Called by

proc~~utility_inv2~~CalledByGraph proc~utility_inv2 utility_inv2 proc~boltzwann_main boltzwann_main proc~boltzwann_main->proc~utility_inv2

Contents

Source Code


Source Code

  subroutine utility_inv2(a, b, det)                   !
    !==================================================================!
    !                                                                  !
    !! Return in b the adjoint of the 2x2 matrix
    !! a, together with the determinant of a.
    !! The inverse is defined as the adjoind divided by the
    !! determinant, so that inverse(a) = b/det
    !                                                                  !
    !===================================================================

    implicit none
    real(kind=dp), intent(in)  :: a(2, 2)
    real(kind=dp), intent(out) :: b(2, 2)
    real(kind=dp), intent(out) :: det

    det = a(1, 1)*a(2, 2) - a(1, 2)*a(2, 1)

    b(1, 1) = a(2, 2)
    b(1, 2) = -a(1, 2)
    b(2, 1) = -a(2, 1)
    b(2, 2) = a(1, 1)

    return

  end subroutine utility_inv2