Chris@202: /* dlaswp.f -- translated by f2c (version 20061008). Chris@202: You must link the resulting object file with libf2c: Chris@202: on Microsoft Windows system, link with libf2c.lib; Chris@202: on Linux or Unix systems, link with .../path/to/libf2c.a -lm Chris@202: or, if you install libf2c.a in a standard place, with -lf2c -lm Chris@202: -- in that order, at the end of the command line, as in Chris@202: cc *.o -lf2c -lm Chris@202: Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., Chris@202: Chris@202: http://www.netlib.org/f2c/libf2c.zip Chris@202: */ Chris@202: Chris@202: #include "f2c.h" Chris@202: #include "blaswrap.h" Chris@202: Chris@202: /* Subroutine */ int dlaswp_(integer *n, doublereal *a, integer *lda, integer Chris@202: *k1, integer *k2, integer *ipiv, integer *incx) Chris@202: { Chris@202: /* System generated locals */ Chris@202: integer a_dim1, a_offset, i__1, i__2, i__3, i__4; Chris@202: Chris@202: /* Local variables */ Chris@202: integer i__, j, k, i1, i2, n32, ip, ix, ix0, inc; Chris@202: doublereal temp; Chris@202: Chris@202: Chris@202: /* -- LAPACK auxiliary routine (version 3.2) -- */ Chris@202: /* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd.. */ Chris@202: /* November 2006 */ Chris@202: Chris@202: /* .. Scalar Arguments .. */ Chris@202: /* .. */ Chris@202: /* .. Array Arguments .. */ Chris@202: /* .. */ Chris@202: Chris@202: /* Purpose */ Chris@202: /* ======= */ Chris@202: Chris@202: /* DLASWP performs a series of row interchanges on the matrix A. */ Chris@202: /* One row interchange is initiated for each of rows K1 through K2 of A. */ Chris@202: Chris@202: /* Arguments */ Chris@202: /* ========= */ Chris@202: Chris@202: /* N (input) INTEGER */ Chris@202: /* The number of columns of the matrix A. */ Chris@202: Chris@202: /* A (input/output) DOUBLE PRECISION array, dimension (LDA,N) */ Chris@202: /* On entry, the matrix of column dimension N to which the row */ Chris@202: /* interchanges will be applied. */ Chris@202: /* On exit, the permuted matrix. */ Chris@202: Chris@202: /* LDA (input) INTEGER */ Chris@202: /* The leading dimension of the array A. */ Chris@202: Chris@202: /* K1 (input) INTEGER */ Chris@202: /* The first element of IPIV for which a row interchange will */ Chris@202: /* be done. */ Chris@202: Chris@202: /* K2 (input) INTEGER */ Chris@202: /* The last element of IPIV for which a row interchange will */ Chris@202: /* be done. */ Chris@202: Chris@202: /* IPIV (input) INTEGER array, dimension (K2*abs(INCX)) */ Chris@202: /* The vector of pivot indices. Only the elements in positions */ Chris@202: /* K1 through K2 of IPIV are accessed. */ Chris@202: /* IPIV(K) = L implies rows K and L are to be interchanged. */ Chris@202: Chris@202: /* INCX (input) INTEGER */ Chris@202: /* The increment between successive values of IPIV. If IPIV */ Chris@202: /* is negative, the pivots are applied in reverse order. */ Chris@202: Chris@202: /* Further Details */ Chris@202: /* =============== */ Chris@202: Chris@202: /* Modified by */ Chris@202: /* R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA */ Chris@202: Chris@202: /* ===================================================================== */ Chris@202: Chris@202: /* .. Local Scalars .. */ Chris@202: /* .. */ Chris@202: /* .. Executable Statements .. */ Chris@202: Chris@202: /* Interchange row I with row IPIV(I) for each of rows K1 through K2. */ Chris@202: Chris@202: /* Parameter adjustments */ Chris@202: a_dim1 = *lda; Chris@202: a_offset = 1 + a_dim1; Chris@202: a -= a_offset; Chris@202: --ipiv; Chris@202: Chris@202: /* Function Body */ Chris@202: if (*incx > 0) { Chris@202: ix0 = *k1; Chris@202: i1 = *k1; Chris@202: i2 = *k2; Chris@202: inc = 1; Chris@202: } else if (*incx < 0) { Chris@202: ix0 = (1 - *k2) * *incx + 1; Chris@202: i1 = *k2; Chris@202: i2 = *k1; Chris@202: inc = -1; Chris@202: } else { Chris@202: return 0; Chris@202: } Chris@202: Chris@202: n32 = *n / 32 << 5; Chris@202: if (n32 != 0) { Chris@202: i__1 = n32; Chris@202: for (j = 1; j <= i__1; j += 32) { Chris@202: ix = ix0; Chris@202: i__2 = i2; Chris@202: i__3 = inc; Chris@202: for (i__ = i1; i__3 < 0 ? i__ >= i__2 : i__ <= i__2; i__ += i__3) Chris@202: { Chris@202: ip = ipiv[ix]; Chris@202: if (ip != i__) { Chris@202: i__4 = j + 31; Chris@202: for (k = j; k <= i__4; ++k) { Chris@202: temp = a[i__ + k * a_dim1]; Chris@202: a[i__ + k * a_dim1] = a[ip + k * a_dim1]; Chris@202: a[ip + k * a_dim1] = temp; Chris@202: /* L10: */ Chris@202: } Chris@202: } Chris@202: ix += *incx; Chris@202: /* L20: */ Chris@202: } Chris@202: /* L30: */ Chris@202: } Chris@202: } Chris@202: if (n32 != *n) { Chris@202: ++n32; Chris@202: ix = ix0; Chris@202: i__1 = i2; Chris@202: i__3 = inc; Chris@202: for (i__ = i1; i__3 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__3) { Chris@202: ip = ipiv[ix]; Chris@202: if (ip != i__) { Chris@202: i__2 = *n; Chris@202: for (k = n32; k <= i__2; ++k) { Chris@202: temp = a[i__ + k * a_dim1]; Chris@202: a[i__ + k * a_dim1] = a[ip + k * a_dim1]; Chris@202: a[ip + k * a_dim1] = temp; Chris@202: /* L40: */ Chris@202: } Chris@202: } Chris@202: ix += *incx; Chris@202: /* L50: */ Chris@202: } Chris@202: } Chris@202: Chris@202: return 0; Chris@202: Chris@202: /* End of DLASWP */ Chris@202: Chris@202: } /* dlaswp_ */