Function that calculates the cross product of the two vectors and .
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=rp), | intent(in), | DIMENSION(3) | :: | a | Vector . |
|
real(kind=rp), | intent(in), | DIMENSION(3) | :: | b | Vector . |
Cross product
pure function cross(a,b)
!! @note Function that calculates the cross product of the two
!! vectors \(\mathbf{a}\) and \(\mathbf{b}\). @endnote
REAL(rp), DIMENSION(3) :: cross
!! Cross product \(\mathbf{a}\times \mathbf{b}\)
REAL(rp), DIMENSION(3), INTENT(IN) :: a
!! Vector \(\mathbf{a}\).
REAL(rp), DIMENSION(3), INTENT(IN) :: b
!! Vector \(\mathbf{b}\).
cross(1) = a(2)*b(3) - a(3)*b(2)
cross(2) = a(3)*b(1) - a(1)*b(3)
cross(3) = a(1)*b(2) - a(2)*b(1)
end function cross