Debian Codegraph @

debian/external_deps/fetk/punc/src/blas/sdsdot.c

raw
1 /* ./src_f77/sdsdot.f -- translated by f2c (version 20030320).
2 You must link the resulting object file with the libraries:
3 -lf2c -lm (in that order)
4 */
5
6 #include <punc/vf2c.h>
7
8 /* DECK SDSDOT */
9 doublereal sdsdot_(integer *n, real *sb, real *sx, integer *incx, real *sy,
10 integer *incy)
11 {
12 /* System generated locals */
13 integer i__1, i__2;
14 real ret_val;
15
16 /* Local variables */
17 static integer i__, ns, kx, ky;
18 static doublereal dsdot;
19
20 /* ***BEGIN PROLOGUE SDSDOT */
21 /* ***PURPOSE Compute the inner product of two vectors with extended */
22 /* precision accumulation. */
23 /* ***LIBRARY SLATEC (BLAS) */
24 /* ***CATEGORY D1A4 */
25 /* ***TYPE SINGLE PRECISION (SDSDOT-S, CDCDOT-C) */
26 /* ***KEYWORDS BLAS, DOT PRODUCT, INNER PRODUCT, LINEAR ALGEBRA, VECTOR */
27 /* ***AUTHOR Lawson, C. L., (JPL) */
28 /* Hanson, R. J., (SNLA) */
29 /* Kincaid, D. R., (U. of Texas) */
30 /* Krogh, F. T., (JPL) */
31 /* ***DESCRIPTION */
32
33 /* B L A S Subprogram */
34 /* Description of Parameters */
35
36 /* --Input-- */
37 /* N number of elements in input vector(s) */
38 /* SB single precision scalar to be added to inner product */
39 /* SX single precision vector with N elements */
40 /* INCX storage spacing between elements of SX */
41 /* SY single precision vector with N elements */
42 /* INCY storage spacing between elements of SY */
43
44 /* --Output-- */
45 /* SDSDOT single precision dot product (SB if N .LE. 0) */
46
47 /* Returns S.P. result with dot product accumulated in D.P. */
48 /* SDSDOT = SB + sum for I = 0 to N-1 of SX(LX+I*INCX)*SY(LY+I*INCY), */
49 /* where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is */
50 /* defined in a similar way using INCY. */
51
52 /* ***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T. */
53 /* Krogh, Basic linear algebra subprograms for Fortran */
54 /* usage, Algorithm No. 539, Transactions on Mathematical */
55 /* Software 5, 3 (September 1979), pp. 308-323. */
56 /* ***ROUTINES CALLED (NONE) */
57 /* ***REVISION HISTORY (YYMMDD) */
58 /* 791001 DATE WRITTEN */
59 /* 890531 Changed all specific intrinsics to generic. (WRB) */
60 /* 890831 Modified array declarations. (WRB) */
61 /* 890831 REVISION DATE from Version 3.2 */
62 /* 891214 Prologue converted to Version 4.0 format. (BAB) */
63 /* 920310 Corrected definition of LX in DESCRIPTION. (WRB) */
64 /* 920501 Reformatted the REFERENCES section. (WRB) */
65 /* ***END PROLOGUE SDSDOT */
66 /* ***FIRST EXECUTABLE STATEMENT SDSDOT */
67 /* Parameter adjustments */
68 --sy;
69 --sx;
70
71 /* Function Body */
72 dsdot = *sb;
73 if (*n <= 0) {
74 goto L30;
75 }
76 if (*incx == *incy && *incx > 0) {
77 goto L40;
78 }
79
80 /* Code for unequal or nonpositive increments. */
81
82 kx = 1;
83 ky = 1;
84 if (*incx < 0) {
85 kx = (1 - *n) * *incx + 1;
86 }
87 if (*incy < 0) {
88 ky = (1 - *n) * *incy + 1;
89 }
90 i__1 = *n;
91 for (i__ = 1; i__ <= i__1; ++i__) {
92 dsdot += (doublereal) sx[kx] * (doublereal) sy[ky];
93 kx += *incx;
94 ky += *incy;
95 /* L10: */
96 }
97 L30:
98 ret_val = dsdot;
99 return ret_val;
100
101 /* Code for equal and positive increments. */
102
103 L40:
104 ns = *n * *incx;
105 i__1 = ns;
106 i__2 = *incx;
107 for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
108 dsdot += (doublereal) sx[i__] * (doublereal) sy[i__];
109 /* L50: */
110 }
111 ret_val = dsdot;
112 return ret_val;
113 } /* sdsdot_ */
114