Debian Codegraph @

debian/external_deps/fetk/punc/src/arpack/iswap.c

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