crossprod Function

public pure function crossprod(a, b) result(c)

Implements the cross/vector product between two 3D vectors

Arguments

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

First vector

real(kind=wp), intent(in) :: b(3)

Second vector

Return Value real(kind=wp), (3)

Orthogonal vector


Source Code

pure function crossprod(a,b) result(c)

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

   !> Second vector
   real(wp), intent(in) :: b(3)

   !> Orthogonal vector
   real(wp) :: c(3)

   c(1) = a(2) * b(3) - b(2) * a(3)
   c(2) = a(3) * b(1) - b(3) * a(1)
   c(3) = a(1) * b(2) - b(1) * a(2)

end function crossprod