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

ddot.c

Go to the documentation of this file.
00001 /* DDOT.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 doublereal __IMPEXP__ ddot_(n, dx, incx, dy, incy)
00009 integer *n;
00010 doublereal *dx;
00011 integer *incx;
00012 doublereal *dy;
00013 integer *incy;
00014 {
00015     /* System generated locals */
00016     integer i__1;
00017     doublereal ret_val;
00018 
00019     /* Local variables */
00020     static integer i, m;
00021     static doublereal dtemp;
00022     static integer ix, iy, mp1;
00023 
00024 
00025 /*     forms the dot product of two vectors. */
00026 /*     uses unrolled loops for increments equal to one. */
00027 /*     jack dongarra, linpack, 3/11/78. */
00028 
00029 
00030     /* Parameter adjustments */
00031     --dy;
00032     --dx;
00033 
00034     /* Function Body */
00035     ret_val = 0.;
00036     dtemp = 0.;
00037     if (*n <= 0) {
00038         return ret_val;
00039     }
00040     if (*incx == 1 && *incy == 1) {
00041         goto L20;
00042     }
00043 
00044 /*        code for unequal increments or equal increments */
00045 /*          not equal to 1 */
00046 
00047     ix = 1;
00048     iy = 1;
00049     if (*incx < 0) {
00050         ix = (-(*n) + 1) * *incx + 1;
00051     }
00052     if (*incy < 0) {
00053         iy = (-(*n) + 1) * *incy + 1;
00054     }
00055     i__1 = *n;
00056     for (i = 1; i <= i__1; ++i) {
00057         dtemp += dx[ix] * dy[iy];
00058         ix += *incx;
00059         iy += *incy;
00060 /* L10: */
00061     }
00062     ret_val = dtemp;
00063     return ret_val;
00064 
00065 /*        code for both increments equal to 1 */
00066 
00067 
00068 /*        clean-up loop */
00069 
00070 L20:
00071     m = *n % 5;
00072     if (m == 0) {
00073         goto L40;
00074     }
00075     i__1 = m;
00076     for (i = 1; i <= i__1; ++i) {
00077         dtemp += dx[i] * dy[i];
00078 /* L30: */
00079     }
00080     if (*n < 5) {
00081         goto L60;
00082     }
00083 L40:
00084     mp1 = m + 1;
00085     i__1 = *n;
00086     for (i = mp1; i <= i__1; i += 5) {
00087         dtemp = dtemp + dx[i] * dy[i] + dx[i + 1] * dy[i + 1] + dx[i + 2] * 
00088                 dy[i + 2] + dx[i + 3] * dy[i + 3] + dx[i + 4] * dy[i + 4];
00089 /* L50: */
00090     }
00091 L60:
00092     ret_val = dtemp;
00093     return ret_val;
00094 } /* ddot_ */
00095 

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