daxpy.c
Go to the documentation of this file.
00001 /* daxpy.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 daxpy_(integer *n, doublereal *da, doublereal *dx, 
00017         integer *incx, doublereal *dy, integer *incy)
00018 {
00019     /* System generated locals */
00020     integer i__1;
00021 
00022     /* Local variables */
00023     integer i__, m, ix, iy, mp1;
00024 
00025 /*     .. Scalar Arguments .. */
00026 /*     .. */
00027 /*     .. Array Arguments .. */
00028 /*     .. */
00029 
00030 /*  Purpose */
00031 /*  ======= */
00032 
00033 /*     constant times a vector plus a vector. */
00034 /*     uses unrolled loops for increments equal to one. */
00035 /*     jack dongarra, linpack, 3/11/78. */
00036 /*     modified 12/3/93, array(1) declarations changed to array(*) */
00037 
00038 
00039 /*     .. Local Scalars .. */
00040 /*     .. */
00041 /*     .. Intrinsic Functions .. */
00042 /*     .. */
00043     /* Parameter adjustments */
00044     --dy;
00045     --dx;
00046 
00047     /* Function Body */
00048     if (*n <= 0) {
00049         return 0;
00050     }
00051     if (*da == 0.) {
00052         return 0;
00053     }
00054     if (*incx == 1 && *incy == 1) {
00055         goto L20;
00056     }
00057 
00058 /*        code for unequal increments or equal increments */
00059 /*          not equal to 1 */
00060 
00061     ix = 1;
00062     iy = 1;
00063     if (*incx < 0) {
00064         ix = (-(*n) + 1) * *incx + 1;
00065     }
00066     if (*incy < 0) {
00067         iy = (-(*n) + 1) * *incy + 1;
00068     }
00069     i__1 = *n;
00070     for (i__ = 1; i__ <= i__1; ++i__) {
00071         dy[iy] += *da * dx[ix];
00072         ix += *incx;
00073         iy += *incy;
00074 /* L10: */
00075     }
00076     return 0;
00077 
00078 /*        code for both increments equal to 1 */
00079 
00080 
00081 /*        clean-up loop */
00082 
00083 L20:
00084     m = *n % 4;
00085     if (m == 0) {
00086         goto L40;
00087     }
00088     i__1 = m;
00089     for (i__ = 1; i__ <= i__1; ++i__) {
00090         dy[i__] += *da * dx[i__];
00091 /* L30: */
00092     }
00093     if (*n < 4) {
00094         return 0;
00095     }
00096 L40:
00097     mp1 = m + 1;
00098     i__1 = *n;
00099     for (i__ = mp1; i__ <= i__1; i__ += 4) {
00100         dy[i__] += *da * dx[i__];
00101         dy[i__ + 1] += *da * dx[i__ + 1];
00102         dy[i__ + 2] += *da * dx[i__ + 2];
00103         dy[i__ + 3] += *da * dx[i__ + 3];
00104 /* L50: */
00105     }
00106     return 0;
00107 } /* daxpy_ */


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