sdsdot.c
Go to the documentation of this file.
00001 /* sdsdot.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 doublereal sdsdot_(integer *n, real *sb, real *sx, integer *incx, real *sy, 
00017         integer *incy)
00018 {
00019     /* System generated locals */
00020     integer i__1, i__2;
00021     real ret_val;
00022 
00023     /* Local variables */
00024     integer i__, ns, kx, ky;
00025     doublereal dsdot;
00026 
00027 /*     .. Scalar Arguments .. */
00028 /*     .. */
00029 /*     .. Array Arguments .. */
00030 /*     .. */
00031 
00032 /*  PURPOSE */
00033 /*  ======= */
00034 
00035 /*  Compute the inner product of two vectors with extended */
00036 /*  precision accumulation. */
00037 
00038 /*  Returns S.P. result with dot product accumulated in D.P. */
00039 /*  SDSDOT = SB + sum for I = 0 to N-1 of SX(LX+I*INCX)*SY(LY+I*INCY), */
00040 /*  where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is */
00041 /*  defined in a similar way using INCY. */
00042 
00043 /*  AUTHOR */
00044 /*  ====== */
00045 /*  Lawson, C. L., (JPL), Hanson, R. J., (SNLA), */
00046 /*  Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL) */
00047 
00048 /*  ARGUMENTS */
00049 /*  ========= */
00050 
00051 /*  N      (input) INTEGER */
00052 /*         number of elements in input vector(s) */
00053 
00054 /*  SB     (input) REAL */
00055 /*         single precision scalar to be added to inner product */
00056 
00057 /*  SX     (input) REAL array, dimension (N) */
00058 /*         single precision vector with N elements */
00059 
00060 /*  INCX   (input) INTEGER */
00061 /*         storage spacing between elements of SX */
00062 
00063 /*  SY     (input) REAL array, dimension (N) */
00064 /*         single precision vector with N elements */
00065 
00066 /*  INCY   (input) INTEGER */
00067 /*         storage spacing between elements of SY */
00068 
00069 /*  SDSDOT (output) REAL */
00070 /*         single precision dot product (SB if N .LE. 0) */
00071 
00072 /*  REFERENCES */
00073 /*  ========== */
00074 
00075 /*  C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T. */
00076 /*  Krogh, Basic linear algebra subprograms for Fortran */
00077 /*  usage, Algorithm No. 539, Transactions on Mathematical */
00078 /*  Software 5, 3 (September 1979), pp. 308-323. */
00079 
00080 /*  REVISION HISTORY  (YYMMDD) */
00081 /*  ========================== */
00082 
00083 /*  791001  DATE WRITTEN */
00084 /*  890531  Changed all specific intrinsics to generic.  (WRB) */
00085 /*  890831  Modified array declarations.  (WRB) */
00086 /*  890831  REVISION DATE from Version 3.2 */
00087 /*  891214  Prologue converted to Version 4.0 format.  (BAB) */
00088 /*  920310  Corrected definition of LX in DESCRIPTION.  (WRB) */
00089 /*  920501  Reformatted the REFERENCES section.  (WRB) */
00090 /*  070118  Reformat to LAPACK coding style */
00091 
00092 /*  ===================================================================== */
00093 
00094 /*     .. Local Scalars .. */
00095 /*     .. */
00096 /*     .. Intrinsic Functions .. */
00097 /*     .. */
00098     /* Parameter adjustments */
00099     --sy;
00100     --sx;
00101 
00102     /* Function Body */
00103     dsdot = *sb;
00104     if (*n <= 0) {
00105         goto L30;
00106     }
00107     if (*incx == *incy && *incx > 0) {
00108         goto L40;
00109     }
00110 
00111 /*     Code for unequal or nonpositive increments. */
00112 
00113     kx = 1;
00114     ky = 1;
00115     if (*incx < 0) {
00116         kx = (1 - *n) * *incx + 1;
00117     }
00118     if (*incy < 0) {
00119         ky = (1 - *n) * *incy + 1;
00120     }
00121     i__1 = *n;
00122     for (i__ = 1; i__ <= i__1; ++i__) {
00123         dsdot += (doublereal) sx[kx] * (doublereal) sy[ky];
00124         kx += *incx;
00125         ky += *incy;
00126 /* L10: */
00127     }
00128 L30:
00129     ret_val = dsdot;
00130     return ret_val;
00131 
00132 /*     Code for equal and positive increments. */
00133 
00134 L40:
00135     ns = *n * *incx;
00136     i__1 = ns;
00137     i__2 = *incx;
00138     for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00139         dsdot += (doublereal) sx[i__] * (doublereal) sy[i__];
00140 /* L50: */
00141     }
00142     ret_val = dsdot;
00143     return ret_val;
00144 } /* sdsdot_ */


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:01