Debian Codegraph @

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

raw
1 /* ./src_f77/saxpy.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 /* Subroutine */ int saxpy_(integer *n, real *sa, real *sx, integer *incx,
9 real *sy, integer *incy)
10 {
11 /* System generated locals */
12 integer i__1;
13
14 /* Local variables */
15 static integer i__, m, ix, iy, mp1;
16
17
18 /* constant times a vector plus a vector. */
19 /* uses unrolled loop for increments equal to one. */
20 /* jack dongarra, linpack, 3/11/78. */
21 /* modified 12/3/93, array(1) declarations changed to array(*) */
22
23
24 /* Parameter adjustments */
25 --sy;
26 --sx;
27
28 /* Function Body */
29 if (*n <= 0) {
30 return 0;
31 }
32 if (*sa == 0.f) {
33 return 0;
34 }
35 if (*incx == 1 && *incy == 1) {
36 goto L20;
37 }
38
39 /* code for unequal increments or equal increments */
40 /* not equal to 1 */
41
42 ix = 1;
43 iy = 1;
44 if (*incx < 0) {
45 ix = (-(*n) + 1) * *incx + 1;
46 }
47 if (*incy < 0) {
48 iy = (-(*n) + 1) * *incy + 1;
49 }
50 i__1 = *n;
51 for (i__ = 1; i__ <= i__1; ++i__) {
52 sy[iy] += *sa * sx[ix];
53 ix += *incx;
54 iy += *incy;
55 /* L10: */
56 }
57 return 0;
58
59 /* code for both increments equal to 1 */
60
61
62 /* clean-up loop */
63
64 L20:
65 m = *n % 4;
66 if (m == 0) {
67 goto L40;
68 }
69 i__1 = m;
70 for (i__ = 1; i__ <= i__1; ++i__) {
71 sy[i__] += *sa * sx[i__];
72 /* L30: */
73 }
74 if (*n < 4) {
75 return 0;
76 }
77 L40:
78 mp1 = m + 1;
79 i__1 = *n;
80 for (i__ = mp1; i__ <= i__1; i__ += 4) {
81 sy[i__] += *sa * sx[i__];
82 sy[i__ + 1] += *sa * sx[i__ + 1];
83 sy[i__ + 2] += *sa * sx[i__ + 2];
84 sy[i__ + 3] += *sa * sx[i__ + 3];
85 /* L50: */
86 }
87 return 0;
88 } /* saxpy_ */
89