2329
|
1 double complex function zdotc(n,zx,incx,zy,incy) |
|
2 c |
|
3 c forms the dot product of a vector. |
|
4 c jack dongarra, 3/11/78. |
2608
|
5 c modified 12/3/93, array(1) declarations changed to array(*) |
2329
|
6 c |
2608
|
7 double complex zx(*),zy(*),ztemp |
2329
|
8 integer i,incx,incy,ix,iy,n |
|
9 ztemp = (0.0d0,0.0d0) |
|
10 zdotc = (0.0d0,0.0d0) |
|
11 if(n.le.0)return |
|
12 if(incx.eq.1.and.incy.eq.1)go to 20 |
|
13 c |
|
14 c code for unequal increments or equal increments |
|
15 c not equal to 1 |
|
16 c |
|
17 ix = 1 |
|
18 iy = 1 |
|
19 if(incx.lt.0)ix = (-n+1)*incx + 1 |
|
20 if(incy.lt.0)iy = (-n+1)*incy + 1 |
|
21 do 10 i = 1,n |
|
22 ztemp = ztemp + dconjg(zx(ix))*zy(iy) |
|
23 ix = ix + incx |
|
24 iy = iy + incy |
|
25 10 continue |
|
26 zdotc = ztemp |
|
27 return |
|
28 c |
|
29 c code for both increments equal to 1 |
|
30 c |
|
31 20 do 30 i = 1,n |
|
32 ztemp = ztemp + dconjg(zx(i))*zy(i) |
|
33 30 continue |
|
34 zdotc = ztemp |
|
35 return |
|
36 end |