Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages | Examples

daxpy.c

Go to the documentation of this file.
00001 /* DAXPY.F -- translated by f2c (version 19941215).
00002    You must link the resulting object file with the libraries:
00003         -lf2c -lm   (in that order)
00004 */
00005 
00006 #include "f2c.h"
00007 #include "cblasimpexp.h"
00008 
00009 /* Subroutine */ int __IMPEXP__  daxpy_(n, da, dx, incx, dy, incy)
00010 integer *n;
00011 doublereal *da, *dx;
00012 integer *incx;
00013 doublereal *dy;
00014 integer *incy;
00015 {
00016     /* System generated locals */
00017     integer i__1;
00018 
00019     /* Local variables */
00020     static integer i, m, ix, iy, mp1;
00021 
00022 
00023 /*     constant times a vector plus a vector. */
00024 /*     uses unrolled loops for increments equal to one. */
00025 /*     jack dongarra, linpack, 3/11/78. */
00026 
00027 
00028     /* Parameter adjustments */
00029     --dy;
00030     --dx;
00031 
00032     /* Function Body */
00033     if (*n <= 0) {
00034         return 0;
00035     }
00036     if (*da == 0.) {
00037         return 0;
00038     }
00039     if (*incx == 1 && *incy == 1) {
00040         goto L20;
00041     }
00042 
00043 /*        code for unequal increments or equal increments */
00044 /*          not equal to 1 */
00045 
00046     ix = 1;
00047     iy = 1;
00048     if (*incx < 0) {
00049         ix = (-(*n) + 1) * *incx + 1;
00050     }
00051     if (*incy < 0) {
00052         iy = (-(*n) + 1) * *incy + 1;
00053     }
00054     i__1 = *n;
00055     for (i = 1; i <= i__1; ++i) {
00056         dy[iy] += *da * dx[ix];
00057         ix += *incx;
00058         iy += *incy;
00059 /* L10: */
00060     }
00061     return 0;
00062 
00063 /*        code for both increments equal to 1 */
00064 
00065 
00066 /*        clean-up loop */
00067 
00068 L20:
00069     m = *n % 4;
00070     if (m == 0) {
00071         goto L40;
00072     }
00073     i__1 = m;
00074     for (i = 1; i <= i__1; ++i) {
00075         dy[i] += *da * dx[i];
00076 /* L30: */
00077     }
00078     if (*n < 4) {
00079         return 0;
00080     }
00081 L40:
00082     mp1 = m + 1;
00083     i__1 = *n;
00084     for (i = mp1; i <= i__1; i += 4) {
00085         dy[i] += *da * dx[i];
00086         dy[i + 1] += *da * dx[i + 1];
00087         dy[i + 2] += *da * dx[i + 2];
00088         dy[i + 3] += *da * dx[i + 3];
00089 /* L50: */
00090     }
00091     return 0;
00092 } /* daxpy_ */
00093 

Generated on Wed Sep 5 12:54:19 2007 for DSACSS Operational Code by  doxygen 1.3.9.1