Debian Codegraph @

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

raw
1 /* ./src_f77/dswap.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 dswap_(integer *n, doublereal *dx, integer *incx,
9 doublereal *dy, integer *incy)
10 {
11 /* System generated locals */
12 integer i__1;
13
14 /* Local variables */
15 static integer i__, m, ix, iy, mp1;
16 static doublereal dtemp;
17
18
19 /* interchanges two vectors. */
20 /* uses unrolled loops for increments equal one. */
21 /* jack dongarra, linpack, 3/11/78. */
22 /* modified 12/3/93, array(1) declarations changed to array(*) */
23
24
25 /* Parameter adjustments */
26 --dy;
27 --dx;
28
29 /* Function Body */
30 if (*n <= 0) {
31 return 0;
32 }
33 if (*incx == 1 && *incy == 1) {
34 goto L20;
35 }
36
37 /* code for unequal increments or equal increments not equal */
38 /* to 1 */
39
40 ix = 1;
41 iy = 1;
42 if (*incx < 0) {
43 ix = (-(*n) + 1) * *incx + 1;
44 }
45 if (*incy < 0) {
46 iy = (-(*n) + 1) * *incy + 1;
47 }
48 i__1 = *n;
49 for (i__ = 1; i__ <= i__1; ++i__) {
50 dtemp = dx[ix];
51 dx[ix] = dy[iy];
52 dy[iy] = dtemp;
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 % 3;
66 if (m == 0) {
67 goto L40;
68 }
69 i__1 = m;
70 for (i__ = 1; i__ <= i__1; ++i__) {
71 dtemp = dx[i__];
72 dx[i__] = dy[i__];
73 dy[i__] = dtemp;
74 /* L30: */
75 }
76 if (*n < 3) {
77 return 0;
78 }
79 L40:
80 mp1 = m + 1;
81 i__1 = *n;
82 for (i__ = mp1; i__ <= i__1; i__ += 3) {
83 dtemp = dx[i__];
84 dx[i__] = dy[i__];
85 dy[i__] = dtemp;
86 dtemp = dx[i__ + 1];
87 dx[i__ + 1] = dy[i__ + 1];
88 dy[i__ + 1] = dtemp;
89 dtemp = dx[i__ + 2];
90 dx[i__ + 2] = dy[i__ + 2];
91 dy[i__ + 2] = dtemp;
92 /* L50: */
93 }
94 return 0;
95 } /* dswap_ */
96