inv2 Function

public pure function inv2(J) result(invJ)

Arguments

Type IntentOptional AttributesName
real(kind=wp), intent(in), dimension(2,2):: J

Return Value real(kind=wp), dimension(2,2)


Calls

proc~~inv2~~CallsGraph proc~inv2 inv2 proc~det2 det2 proc~inv2->proc~det2

Contents

Source Code


Source Code

  pure function inv2(J) result(invJ)
    ! Computes the inverse of a 2x2 matrix
    real(wp), dimension(2,2), intent(in)  :: J
    real(wp), dimension(2,2)              :: invJ

    invJ  = reshape( [J(2,2), -J(2,1), -J(1,2), J(1,1)], [2,2] )
    invJ  = invJ / det2(J)

    return
  end function inv2