| 1 |
/* ./src_f77/cdotc.f -- translated by f2c (version 20030320). |
| 2 |
You must link the resulting object file with the libraries: |
| 3 |
-lf2c -lm (in that order) |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <punc/vf2c.h> |
| 7 |
|
| 8 |
/* Complex */ VOID cdotc_(realcomplex * ret_val, integer *n, realcomplex *cx, integer |
| 9 |
*incx, realcomplex *cy, integer *incy) |
| 10 |
{ |
| 11 |
/* System generated locals */ |
| 12 |
integer i__1, i__2; |
| 13 |
realcomplex q__1, q__2, q__3; |
| 14 |
|
| 15 |
/* Builtin functions */ |
| 16 |
void r_cnjg(realcomplex *, realcomplex *); |
| 17 |
|
| 18 |
/* Local variables */ |
| 19 |
static integer i__, ix, iy; |
| 20 |
static realcomplex ctemp; |
| 21 |
|
| 22 |
|
| 23 |
/* forms the dot product of two vectors, conjugating the first */ |
| 24 |
/* vector. */ |
| 25 |
/* jack dongarra, linpack, 3/11/78. */ |
| 26 |
/* modified 12/3/93, array(1) declarations changed to array(*) */ |
| 27 |
|
| 28 |
|
| 29 |
/* Parameter adjustments */ |
| 30 |
--cy; |
| 31 |
--cx; |
| 32 |
|
| 33 |
/* Function Body */ |
| 34 |
ctemp.r = 0.f, ctemp.i = 0.f; |
| 35 |
ret_val->r = 0.f, ret_val->i = 0.f; |
| 36 |
if (*n <= 0) { |
| 37 |
return ; |
| 38 |
} |
| 39 |
if (*incx == 1 && *incy == 1) { |
| 40 |
goto L20; |
| 41 |
} |
| 42 |
|
| 43 |
/* code for unequal increments or equal increments */ |
| 44 |
/* not equal to 1 */ |
| 45 |
|
| 46 |
ix = 1; |
| 47 |
iy = 1; |
| 48 |
if (*incx < 0) { |
| 49 |
ix = (-(*n) + 1) * *incx + 1; |
| 50 |
} |
| 51 |
if (*incy < 0) { |
| 52 |
iy = (-(*n) + 1) * *incy + 1; |
| 53 |
} |
| 54 |
i__1 = *n; |
| 55 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 56 |
r_cnjg(&q__3, &cx[ix]); |
| 57 |
i__2 = iy; |
| 58 |
q__2.r = q__3.r * cy[i__2].r - q__3.i * cy[i__2].i, q__2.i = q__3.r * |
| 59 |
cy[i__2].i + q__3.i * cy[i__2].r; |
| 60 |
q__1.r = ctemp.r + q__2.r, q__1.i = ctemp.i + q__2.i; |
| 61 |
ctemp.r = q__1.r, ctemp.i = q__1.i; |
| 62 |
ix += *incx; |
| 63 |
iy += *incy; |
| 64 |
/* L10: */ |
| 65 |
} |
| 66 |
ret_val->r = ctemp.r, ret_val->i = ctemp.i; |
| 67 |
return ; |
| 68 |
|
| 69 |
/* code for both increments equal to 1 */ |
| 70 |
|
| 71 |
L20: |
| 72 |
i__1 = *n; |
| 73 |
for (i__ = 1; i__ <= i__1; ++i__) { |
| 74 |
r_cnjg(&q__3, &cx[i__]); |
| 75 |
i__2 = i__; |
| 76 |
q__2.r = q__3.r * cy[i__2].r - q__3.i * cy[i__2].i, q__2.i = q__3.r * |
| 77 |
cy[i__2].i + q__3.i * cy[i__2].r; |
| 78 |
q__1.r = ctemp.r + q__2.r, q__1.i = ctemp.i + q__2.i; |
| 79 |
ctemp.r = q__1.r, ctemp.i = q__1.i; |
| 80 |
/* L30: */ |
| 81 |
} |
| 82 |
ret_val->r = ctemp.r, ret_val->i = ctemp.i; |
| 83 |
return ; |
| 84 |
} /* cdotc_ */ |
| 85 |
|