Mercurial > octave-nkf
diff libcruft/lapack/zlaswp.f @ 2329:30c606bec7a8
[project @ 1996-07-19 01:29:05 by jwe]
Initial revision
author | jwe |
---|---|
date | Fri, 19 Jul 1996 01:29:55 +0000 |
parents | |
children | 15cddaacbc2d |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libcruft/lapack/zlaswp.f Fri Jul 19 01:29:55 1996 +0000 @@ -0,0 +1,98 @@ + SUBROUTINE ZLASWP( 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( * ) + COMPLEX*16 A( LDA, * ) +* .. +* +* Purpose +* ======= +* +* ZLASWP 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) COMPLEX*16 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 ZSWAP +* .. +* .. 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 ZSWAP( 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 ZSWAP( 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 ZSWAP( N, A( I, 1 ), LDA, A( IP, 1 ), LDA ) + IX = IX + INCX + 30 CONTINUE + END IF +* + RETURN +* +* End of ZLASWP +* + END