c@427: /* dswap.f -- translated by f2c (version 20061008). c@427: You must link the resulting object file with libf2c: c@427: on Microsoft Windows system, link with libf2c.lib; c@427: on Linux or Unix systems, link with .../path/to/libf2c.a -lm c@427: or, if you install libf2c.a in a standard place, with -lf2c -lm c@427: -- in that order, at the end of the command line, as in c@427: cc *.o -lf2c -lm c@427: Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., c@427: c@427: http://www.netlib.org/f2c/libf2c.zip c@427: */ c@427: c@427: #include "f2c.h" c@427: #include "blaswrap.h" c@427: c@427: /* Subroutine */ int dswap_(integer *n, doublereal *dx, integer *incx, c@427: doublereal *dy, integer *incy) c@427: { c@427: /* System generated locals */ c@427: integer i__1; c@427: c@427: /* Local variables */ c@427: integer i__, m, ix, iy, mp1; c@427: doublereal dtemp; c@427: c@427: /* .. Scalar Arguments .. */ c@427: /* .. */ c@427: /* .. Array Arguments .. */ c@427: /* .. */ c@427: c@427: /* Purpose */ c@427: /* ======= */ c@427: c@427: /* interchanges two vectors. */ c@427: /* uses unrolled loops for increments equal one. */ c@427: /* jack dongarra, linpack, 3/11/78. */ c@427: /* modified 12/3/93, array(1) declarations changed to array(*) */ c@427: c@427: c@427: /* .. Local Scalars .. */ c@427: /* .. */ c@427: /* .. Intrinsic Functions .. */ c@427: /* .. */ c@427: /* Parameter adjustments */ c@427: --dy; c@427: --dx; c@427: c@427: /* Function Body */ c@427: if (*n <= 0) { c@427: return 0; c@427: } c@427: if (*incx == 1 && *incy == 1) { c@427: goto L20; c@427: } c@427: c@427: /* code for unequal increments or equal increments not equal */ c@427: /* to 1 */ c@427: c@427: ix = 1; c@427: iy = 1; c@427: if (*incx < 0) { c@427: ix = (-(*n) + 1) * *incx + 1; c@427: } c@427: if (*incy < 0) { c@427: iy = (-(*n) + 1) * *incy + 1; c@427: } c@427: i__1 = *n; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: dtemp = dx[ix]; c@427: dx[ix] = dy[iy]; c@427: dy[iy] = dtemp; c@427: ix += *incx; c@427: iy += *incy; c@427: /* L10: */ c@427: } c@427: return 0; c@427: c@427: /* code for both increments equal to 1 */ c@427: c@427: c@427: /* clean-up loop */ c@427: c@427: L20: c@427: m = *n % 3; c@427: if (m == 0) { c@427: goto L40; c@427: } c@427: i__1 = m; c@427: for (i__ = 1; i__ <= i__1; ++i__) { c@427: dtemp = dx[i__]; c@427: dx[i__] = dy[i__]; c@427: dy[i__] = dtemp; c@427: /* L30: */ c@427: } c@427: if (*n < 3) { c@427: return 0; c@427: } c@427: L40: c@427: mp1 = m + 1; c@427: i__1 = *n; c@427: for (i__ = mp1; i__ <= i__1; i__ += 3) { c@427: dtemp = dx[i__]; c@427: dx[i__] = dy[i__]; c@427: dy[i__] = dtemp; c@427: dtemp = dx[i__ + 1]; c@427: dx[i__ + 1] = dy[i__ + 1]; c@427: dy[i__ + 1] = dtemp; c@427: dtemp = dx[i__ + 2]; c@427: dx[i__ + 2] = dy[i__ + 2]; c@427: dy[i__ + 2] = dtemp; c@427: /* L50: */ c@427: } c@427: return 0; c@427: } /* dswap_ */