HP MLIB User's Guide Vol. 1 7th Ed.
Chapter 2 Basic Vector Operations 91
Sparse dot product SDOTI/DDOTI/CDOTCI/CDOTUI/ZDOTCI/ZDOTUI
Example Compute the REAL*8 sparse dot product
where x is a sparse vector with interesting elements x
1
, x
4
, x
5
, and x
9
stored in
one-dimensional array X, and y is a vector 10 elements long stored in a
one-dimensional array Y of dimension 20.
INTEGER*4 M,INDX(4)
REAL*8 S,DDOTI,X(4),Y(20)
DATA INDX / 1, 4, 5, 9 /
M = 4
S = DDOTI (M,X,INDX,Y)
sx
i
y
i,
i 1=
10
∑
=