| 1 |
/* ./src_f77/caxpy.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 |
/* Subroutine */ int caxpy_(integer *n, realcomplex *ca, realcomplex *cx, integer * |
| 9 |
incx, realcomplex *cy, integer *incy) |
| 10 |
{ |
| 11 |
/* System generated locals */ |
| 12 |
integer i__1, i__2, i__3, i__4; |
| 13 |
real r__1, r__2; |
| 14 |
realcomplex q__1, q__2; |
| 15 |
|
| 16 |
/* Builtin functions */ |
| 17 |
double r_imag(realcomplex *); |
| 18 |
|
| 19 |
/* Local variables */ |
| 20 |
static integer i__, ix, iy; |
| 21 |
|
| 22 |
|
| 23 |
/* constant times a vector plus a vector. */ |
| 24 |
/* jack dongarra, linpack, 3/11/78. */ |
| 25 |
/* modified 12/3/93, array(1) declarations changed to array(*) */ |
| 26 |
|
| 27 |
|
| 28 |
/* Parameter adjustments */ |
| 29 |
--cy; |
| 30 |
--cx; |
| 31 |
|
| 32 |
/* Function Body */ |
| 33 |
if (*n <= 0) { |
| 34 |
return 0; |
| 35 |
} |
| 36 |
if ((r__1 = ca->r, dabs(r__1)) + (r__2 = r_imag(ca), dabs(r__2)) == 0.f) { |
| 37 |
return 0; |
| 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 |
i__2 = iy; |
| 57 |
i__3 = iy; |
| 58 |
i__4 = ix; |
| 59 |
q__2.r = ca->r * cx[i__4].r - ca->i * cx[i__4].i, q__2.i = ca->r * cx[ |
| 60 |
i__4].i + ca->i * cx[i__4].r; |
| 61 |
q__1.r = cy[i__3].r + q__2.r, q__1.i = cy[i__3].i + q__2.i; |
| 62 |
cy[i__2].r = q__1.r, cy[i__2].i = q__1.i; |
| 63 |
ix += *incx; |
| 64 |
iy += *incy; |
| 65 |
/* L10: */ |
| 66 |
} |
| 67 |
return 0; |
| 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 |
i__2 = i__; |
| 75 |
i__3 = i__; |
| 76 |
i__4 = i__; |
| 77 |
q__2.r = ca->r * cx[i__4].r - ca->i * cx[i__4].i, q__2.i = ca->r * cx[ |
| 78 |
i__4].i + ca->i * cx[i__4].r; |
| 79 |
q__1.r = cy[i__3].r + q__2.r, q__1.i = cy[i__3].i + q__2.i; |
| 80 |
cy[i__2].r = q__1.r, cy[i__2].i = q__1.i; |
| 81 |
/* L30: */ |
| 82 |
} |
| 83 |
return 0; |
| 84 |
} /* caxpy_ */ |
| 85 |
|