Description: | Performs dot-product multiplication of numeric or logical vectors (rank-one arrays). | ||
Class: | Transformational function; Generic | ||
Arguments: | VECTOR_A | Must be a rank-one array of numeric (integer, real, or complex) or logical type. | |
VECTOR_B | Must be a rank-one array of numeric type if VECTOR_A is of numeric type, or of logical type if VECTOR_A is of logical type. It must be the same size as VECTOR_A. | ||
Results: | The result is a scalar whose type depends
on the types of VECTOR_A and VECTOR_B.
If VECTOR_A is of type integer or real, the result value is SUM (VECTOR_A*VECTOR_B). If VECTOR_A is of type complex, the result value is SUM (CONJG (VECTOR_A)*VECTOR_B). If VECTOR_A is of type logical, the result has the value ANY (VECTOR_A .AND. VECTOR_B). If either rank-one array has size zero, the result is zero if the array is of numeric type, and false if the array is of logical type. (For more information on expressions, see Section 4.1.) |
Examples
DOT_PRODUCT ((/1, 2, 3/), (/3, 4, 5/)) has the value 26 (calculated
as follows: ((1 x 3) + (2 x 4) + (3 x 5)) = 26
).
DOT_PRODUCT ((/ (1.0, 2.0), (2.0, 3.0) /), (/ (1.0, 1.0), (1.0, 4.0) /)) has the value (17.0, 4.0).
DOT_PRODUCT ((/ .TRUE., .FALSE. /), (/ .FALSE., .TRUE. /)) has the value false.