1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
|
SUBROUTINE DLASWP( N, A, LDA, K1, K2, IPIV, INCX )
*
* -- LAPACK auxiliary routine (version 2.0) --
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
* Courant Institute, Argonne National Lab, and Rice University
* October 31, 1992
*
* .. Scalar Arguments ..
INTEGER INCX, K1, K2, LDA, N
* ..
* .. Array Arguments ..
INTEGER IPIV( * )
DOUBLE PRECISION A( LDA, * )
* ..
*
* Purpose
* =======
*
* DLASWP performs a series of row interchanges on the matrix A.
* One row interchange is initiated for each of rows K1 through K2 of A.
*
* Arguments
* =========
*
* N (input) INTEGER
* The number of columns of the matrix A.
*
* A (input/output) DOUBLE PRECISION array, dimension (LDA,N)
* On entry, the matrix of column dimension N to which the row
* interchanges will be applied.
* On exit, the permuted matrix.
*
* LDA (input) INTEGER
* The leading dimension of the array A.
*
* K1 (input) INTEGER
* The first element of IPIV for which a row interchange will
* be done.
*
* K2 (input) INTEGER
* The last element of IPIV for which a row interchange will
* be done.
*
* IPIV (input) INTEGER array, dimension (M*abs(INCX))
* The vector of pivot indices. Only the elements in positions
* K1 through K2 of IPIV are accessed.
* IPIV(K) = L implies rows K and L are to be interchanged.
*
* INCX (input) INTEGER
* The increment between successive values of IPIV. If IPIV
* is negative, the pivots are applied in reverse order.
*
* =====================================================================
*
* .. Local Scalars ..
INTEGER I, IP, IX
* ..
* .. External Subroutines ..
EXTERNAL DSWAP
* ..
* .. Executable Statements ..
*
* Interchange row I with row IPIV(I) for each of rows K1 through K2.
*
IF( INCX.EQ.0 )
$ RETURN
IF( INCX.GT.0 ) THEN
IX = K1
ELSE
IX = 1 + ( 1-K2 )*INCX
END IF
IF( INCX.EQ.1 ) THEN
DO 10 I = K1, K2
IP = IPIV( I )
IF( IP.NE.I )
$ CALL DSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA )
10 CONTINUE
ELSE IF( INCX.GT.1 ) THEN
DO 20 I = K1, K2
IP = IPIV( IX )
IF( IP.NE.I )
$ CALL DSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA )
IX = IX + INCX
20 CONTINUE
ELSE IF( INCX.LT.0 ) THEN
DO 30 I = K2, K1, -1
IP = IPIV( IX )
IF( IP.NE.I )
$ CALL DSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA )
IX = IX + INCX
30 CONTINUE
END IF
*
RETURN
*
* End of DLASWP
*
END
|