caxpy.c
Go to the documentation of this file.
00001 /* caxpy.f -- translated by f2c (version 20061008).
00002    You must link the resulting object file with libf2c:
00003         on Microsoft Windows system, link with libf2c.lib;
00004         on Linux or Unix systems, link with .../path/to/libf2c.a -lm
00005         or, if you install libf2c.a in a standard place, with -lf2c -lm
00006         -- in that order, at the end of the command line, as in
00007                 cc *.o -lf2c -lm
00008         Source for libf2c is in /netlib/f2c/libf2c.zip, e.g.,
00009 
00010                 http://www.netlib.org/f2c/libf2c.zip
00011 */
00012 
00013 #include "f2c.h"
00014 #include "blaswrap.h"
00015 
00016 /* Subroutine */ int caxpy_(integer *n, complex *ca, complex *cx, integer *
00017         incx, complex *cy, integer *incy)
00018 {
00019     /* System generated locals */
00020     integer i__1, i__2, i__3, i__4;
00021     complex q__1, q__2;
00022 
00023     /* Local variables */
00024     integer i__, ix, iy;
00025     extern doublereal scabs1_(complex *);
00026 
00027 /*     .. Scalar Arguments .. */
00028 /*     .. */
00029 /*     .. Array Arguments .. */
00030 /*     .. */
00031 
00032 /*  Purpose */
00033 /*  ======= */
00034 
00035 /*     CAXPY constant times a vector plus a vector. */
00036 
00037 /*  Further Details */
00038 /*  =============== */
00039 
00040 /*     jack dongarra, linpack, 3/11/78. */
00041 /*     modified 12/3/93, array(1) declarations changed to array(*) */
00042 
00043 /*     .. Local Scalars .. */
00044 /*     .. */
00045 /*     .. External Functions .. */
00046 /*     .. */
00047     /* Parameter adjustments */
00048     --cy;
00049     --cx;
00050 
00051     /* Function Body */
00052     if (*n <= 0) {
00053         return 0;
00054     }
00055     if (scabs1_(ca) == 0.f) {
00056         return 0;
00057     }
00058     if (*incx == 1 && *incy == 1) {
00059         goto L20;
00060     }
00061 
00062 /*        code for unequal increments or equal increments */
00063 /*          not equal to 1 */
00064 
00065     ix = 1;
00066     iy = 1;
00067     if (*incx < 0) {
00068         ix = (-(*n) + 1) * *incx + 1;
00069     }
00070     if (*incy < 0) {
00071         iy = (-(*n) + 1) * *incy + 1;
00072     }
00073     i__1 = *n;
00074     for (i__ = 1; i__ <= i__1; ++i__) {
00075         i__2 = iy;
00076         i__3 = iy;
00077         i__4 = ix;
00078         q__2.r = ca->r * cx[i__4].r - ca->i * cx[i__4].i, q__2.i = ca->r * cx[
00079                 i__4].i + ca->i * cx[i__4].r;
00080         q__1.r = cy[i__3].r + q__2.r, q__1.i = cy[i__3].i + q__2.i;
00081         cy[i__2].r = q__1.r, cy[i__2].i = q__1.i;
00082         ix += *incx;
00083         iy += *incy;
00084 /* L10: */
00085     }
00086     return 0;
00087 
00088 /*        code for both increments equal to 1 */
00089 
00090 L20:
00091     i__1 = *n;
00092     for (i__ = 1; i__ <= i__1; ++i__) {
00093         i__2 = i__;
00094         i__3 = i__;
00095         i__4 = i__;
00096         q__2.r = ca->r * cx[i__4].r - ca->i * cx[i__4].i, q__2.i = ca->r * cx[
00097                 i__4].i + ca->i * cx[i__4].r;
00098         q__1.r = cy[i__3].r + q__2.r, q__1.i = cy[i__3].i + q__2.i;
00099         cy[i__2].r = q__1.r, cy[i__2].i = q__1.i;
00100 /* L30: */
00101     }
00102     return 0;
00103 } /* caxpy_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:55:15