Weighted dot product

SWDOT/DWDOT/CWDOTC/CWDOTU/ZWDOTC/ZWDOTU

Example 1 Compute the REAL*8 weighted dot product

 

10

s =

wi xi yi,

 

i = 1

where w, x, and y are vectors 10 elements long stored in one-dimensional arrays W, X, and Y, of dimension 20.

INTEGER*4 N,INCW,INCX,INCY

REAL*8

S,DWDOT,W(20),X(20),Y(20)

N = 10

 

INCW = 1

 

INCX = 1

INCY = 1

S = DWDOT (N,W,INCW,X,INCX,Y,INCY)

Example 2 Compute the REAL*8 weighted dot product

10

s = wi xi yi,

i = 1

where w and y are vectors 10 elements long stored in one-dimensional arrays W and Y of dimension 20, and x is the 4th row of a 10-by-10 matrix stored in a two-dimensional array X of dimension 20-by-21.

INTEGER*4

N

REAL*8

S,DWDOT,W(20),X(20,21),Y(20)

N =

10

 

S =

DWDOT (N,W,1,X(I,1),20,Y,1)

Chapter 2 Basic Vector Operations 149