Manual Reference Pages  - dot_product (3fortran)

NAME

DOT_PRODUCT(3) - [TRANSFORMATIONAL] Dot product of two vectors

SYNOPSIS

result = dot_product(vector_a, vector_b)

         TYPE(kind=KIND) function dot_product(vector_a, vector_b)

TYPE(kind=KIND),intent(in) :: vector_a(:) TYPE(kind=KIND),intent(in) :: vector_b(:)

CHARACTERISTICS

o VECTOR_A, VECTOR_B may be any numeric or logical type array of rank one of the same size
o the two vectors need not be of the same kind, but both must be logical or numeric for any given call.
o the result is the same type and kind of the vector that is the higher type that the other vector is optionally promoted to if they differ.
The two vectors may be either numeric or logical and must be arrays of rank one and of equal size.

DESCRIPTION

DOT_PRODUCT(3) computes the dot product multiplication of two vectors VECTOR_A and VECTOR_B.

OPTIONS

o VECTOR_A : A rank 1 vector of values
o 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 of the same size as VECTOR_A.

RESULT

If the arguments are numeric, the return value is a scalar of numeric type. If the arguments are logical, the return value is .true. or [char46]false..

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)

EXAMPLES

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

Results:

      >  1  2  3
      >
      >  4  5  6
      >
      >           32

STANDARD

Fortran 95

SEE ALSO

SUM(3), CONJG(3), ANY(3)

fortran-lang intrinsic descriptions (license: MIT) @urbanjost


Nemo Release 3.1 dot_product (3fortran) April 28, 2024
Generated by manServer 1.08 from 107637d4-e49c-40a1-93cf-005797ca6d30 using man macros.