Calculates the cross product of two vectors: u
xv
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in), | dimension(3) | :: | u | ||
real(kind=Float64), | intent(in), | dimension(3) | :: | v |
function cross_product(u, v) result(s)
!+ Calculates the cross product of two vectors: `u`x`v`
real(Float64), dimension(3), intent(in) :: u
real(Float64), dimension(3), intent(in) :: v
real(Float64), dimension(3) :: s
s(1) = u(2)*v(3) - u(3)*v(2)
s(2) = u(3)*v(1) - u(1)*v(3)
s(3) = u(1)*v(2) - u(2)*v(1)
end function cross_product