DOT_PRODUCT — Dot product function#
-
DOT_PRODUCT(VECTOR_A, VECTOR_B)#
DOT_PRODUCT(VECTOR_A, VECTOR_B)
computes the dot product multiplication of two vectorsVECTOR_A
andVECTOR_B
. The two vectors may be either numeric or logical and must be arrays of rank one and of equal size. If the vectors areINTEGER
orREAL
, the result isSUM(VECTOR_A*VECTOR_B)
. If the vectors areCOMPLEX
, the result isSUM(CONJG(VECTOR_A)*VECTOR_B)
. If the vectors areLOGICAL
, the result isANY(VECTOR_A .AND. VECTOR_B)
.- Parameters:
VECTOR_A – The type shall be numeric or
LOGICAL
, rank 1.VECTOR_B – The type shall be numeric if
VECTOR_A
is of numeric type orLOGICAL
ifVECTOR_A
is of typeLOGICAL
.VECTOR_B
shall be a rank-one array.
- Returns:
If the arguments are numeric, the return value is a scalar of numeric type,
INTEGER
,REAL
, orCOMPLEX
. If the arguments areLOGICAL
, the return value is.TRUE.
or.FALSE.
.
- Standard:
Fortran 90 and later
- Class:
Transformational function
- Syntax:
RESULT = DOT_PRODUCT(VECTOR_A, VECTOR_B)
- 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