Dot_product is a vector ( arrays of rank one ) intrinsic function.
The function dot_product takes two vectors ( arrays of rank one ) and computes the dot product of the two. This can be done on REAL, INTEGER, COMPLEX or LOGICAL arguments.
dot_product( vectorA, vectorB )
VectorA must be either an INTEGER, REAL, or LOGICAL array of rank one. VectorB must be of the same type of VectorA.
There are no optional arguments.
Lets say you have two arrays, a(3) and b(3). The values stored in array a are 1,6,-9 and the values in array b are 3,-10,-7. If you need to find the dot_product of these two vectors all you would have to do is type the following line of code.
X = dot_product(a,b)
Notice that the function outputs to a scalar. Remember from some previous course that the result of the dot product operation is always a scalar. The results of this dot product operation would be six ( (1*3) + ( -10*6) + (-9*-7) = 6 ).
lecture thirty six
examples: matprod.f, speed.f, lsq3.f, and trapz2.f
Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu