matdet_3x3 Function

public pure function matdet_3x3(a) result(det)

Determinant of 3×3 matrix

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: a(3,3)

Matrix

Return Value real(kind=wp)

Determinant


Source Code

pure function matdet_3x3(a) result (det)

   !> Matrix
   real(wp), intent(in) :: a(3, 3)

   !> Determinant
   real(wp) :: det

   det =  a(1, 1) * a(2, 2) * a(3, 3)  &
      & - a(1, 1) * a(2, 3) * a(3, 2)  &
      & - a(1, 2) * a(2, 1) * a(3, 3)  &
      & + a(1, 2) * a(2, 3) * a(3, 1)  &
      & + a(1, 3) * a(2, 1) * a(3, 2)  &
      & - a(1, 3) * a(2, 2) * a(3, 1)

end function matdet_3x3