Next: , Previous: DIM, Up: Intrinsic Procedures


6.57 DOT_PRODUCT — Dot product function

Description:
DOT_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).
Standard:
F95 and later
Class:
Transformational function
Syntax:
RESULT = DOT_PRODUCT(X, Y)
Arguments:

X The type shall be numeric or LOGICAL, rank 1.
Y The type shall be numeric or LOGICAL, rank 1.

Return value:
If the arguments are numeric, the return value is a scaler of numeric type, INTEGER(*), REAL(*), or COMPLEX(*). If the arguments are LOGICAL, the return value is .TRUE. or .FALSE..
Example:
          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