[UP]


Manual Reference Pages  - dot_product (3)

NAME

dot_product(3f) - [FORTRAN:INTRINSIC:TRANSFORMATIONAL FUNCTION] Dot product function

SYNTAX

result = dot_product(vector_a, vector_b)

DESCRIPTION

dot_product(vector_a, vector_b) computes the dot product multiplication of two vectors vector_a and vector_b. 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(vector_a*vector_b). If the vectors are COMPLEX, the result is sum(conjg(vector_a)*vector_b). If the vectors are LOGICAL, the result is any(vector_a .and. vector_b).

ARGUMENTS

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 or LOGICAL if vector_a is of type LOGICAL. vector_b shall be a rank-one array.

RETURN VALUE

If the arguments are numeric, the return value is a scalar of numeric type, INTEGER, REAL, or COMPLEX. If the arguments are LOGICAL, the return value is .true. or .false..

EXAMPLE

Sample program:

    program demo_dot_prod
    implicit none
        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 demo_dot_prod

STANDARD

[[Fortran 95]] and later

CLASS

Transformational function


dot_product (3) March 11, 2021
Generated by manServer 1.08 from 83c53961-71a3-41a5-881d-e5974adad7c1 using man macros.