crossproduct Subroutine

public pure subroutine crossproduct(a, b, c)

Arguments

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

Source Code

pure subroutine crossproduct(a, b, c)
   real(wp), intent(in)  :: a(3), b(3)
   real(wp), intent(out) :: c(3)
   real(wp) :: x, y, z

   x = a(2)*b(3)-b(2)*a(3)
   y = a(3)*b(1)-b(3)*a(1)
   z = a(1)*b(2)-b(1)*a(2)
   c = [x, y, z]
end subroutine crossproduct