function that calculates the cross product between two real 3-dimensional vectors and 1
the wedge notation can sometimes be used to denote the vector product. ↩
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| real(kind=dp), | intent(in), | dimension(3) | :: | a | ||
| real(kind=dp), | intent(in), | dimension(3) | :: | b |
function cross(a, b) result(result) real(dp), dimension(3), intent(in) :: a, b real(dp), dimension(3) :: result result(1) = a(2) * b(3) - b(2) * a(3) result(2) = -(a(1) * b(3) - b(1) * a(3)) result(3) = a(1) * b(2) - b(1) * a(2) end function cross