Next: DPROD, Previous: DIM, Up: Intrinsic Procedures
DOT_PRODUCT — Dot product functionDOT_PRODUCT(X,Y) computes the dot product multiplication of two vectors
X and Y. The two vectors may be either numeric or logical
and must be arrays of rank one and of equal size. If the vectors are
INTEGER(*) or REAL(*), the result is SUM(X*Y). If the
vectors are COMPLEX(*), the result is SUM(CONJG(X)*Y). If the
vectors are LOGICAL, the result is ANY(X.AND.Y).
RESULT = DOT_PRODUCT(X, Y)
| X | The type shall be numeric or LOGICAL, rank 1.
|
| Y | The type shall be numeric or LOGICAL, rank 1.
|
INTEGER(*), REAL(*), or COMPLEX(*). If the arguments are
LOGICAL, the return value is .TRUE. or .FALSE..
program test_dot_prod
integer, dimension(3) :: a, b
a = (/ 1, 2, 3 /)
b = (/ 4, 5, 6 /)
print '(3i3)', a
print *
print '(3i3)', b
print *
print *, dot_product(a,b)
end program test_dot_prod