dot(3f) - [M_datapac:VECTOR_OPERATION] compute a dot product of two vectors
Synopsis
Description
Input Options
Output Options
Examples
Author
Maintainer
License
subroutine dot(A,B,Imin,Imax,Parpro,Dotpro)
real(kind=wp),intent(in) :: A(:), B(:), Parpro real(kind=wp),intent(out) :: Dotpro integer,intent(in) :: Imax, Imin
To compute the dot product between 2 vectors A and B only elements IMIN through IMAX of the 2 vectors are considered. The computed dot product is added to the input value PARPRO to yield a final answer for DOTPRO.
Note Fortran now has a dot product intrinsic called DOT_PRODUCT(3f).
A First vector B Second vector Imin First index in A and B to consider Imax Last index in A and B to consider Parpro Initial value to add the dot product to
Dotpro Dot product of A and B.
Sample program:
program demo_dot use M_datapac, only : dot, label real, dimension(3) :: a, b real :: dotpro , parpro integer i , imax , imin call label(dot) a = [ 1.0, 2.0, 3.0 ] b = [ 4.0, 5.0, 6.0 ] imin=1 imax=size(a) parpro=0.0 call dot(a,b,imin,imax,parpro,dotpro) write(*,*)a write(*,*)b write(*,*)dotpro, dot_product(a,b), dotpro == dot_product(a,b) end program demo_dotResults:
1.000000 2.000000 3.000000 4.000000 5.000000 6.000000 32.00000 32.00000 T
The original DATAPAC library was written by James Filliben of the Statistical Engineering Division, National Institute of Standards and Technology.
John Urban, 2022.05.31
CC0-1.0
Nemo Release 3.1 | dot (3) | February 23, 2025 |