summaryrefslogtreecommitdiff
path: root/SRC/zlaswp.f
diff options
context:
space:
mode:
Diffstat (limited to 'SRC/zlaswp.f')
-rw-r--r--SRC/zlaswp.f119
1 files changed, 119 insertions, 0 deletions
diff --git a/SRC/zlaswp.f b/SRC/zlaswp.f
new file mode 100644
index 00000000..8b07e48b
--- /dev/null
+++ b/SRC/zlaswp.f
@@ -0,0 +1,119 @@
+ SUBROUTINE ZLASWP( N, A, LDA, K1, K2, IPIV, INCX )
+*
+* -- LAPACK auxiliary routine (version 3.1) --
+* Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
+* November 2006
+*
+* .. 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 (K2*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.
+*
+* Further Details
+* ===============
+*
+* Modified by
+* R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA
+*
+* =====================================================================
+*
+* .. Local Scalars ..
+ INTEGER I, I1, I2, INC, IP, IX, IX0, J, K, N32
+ COMPLEX*16 TEMP
+* ..
+* .. Executable Statements ..
+*
+* Interchange row I with row IPIV(I) for each of rows K1 through K2.
+*
+ IF( INCX.GT.0 ) THEN
+ IX0 = K1
+ I1 = K1
+ I2 = K2
+ INC = 1
+ ELSE IF( INCX.LT.0 ) THEN
+ IX0 = 1 + ( 1-K2 )*INCX
+ I1 = K2
+ I2 = K1
+ INC = -1
+ ELSE
+ RETURN
+ END IF
+*
+ N32 = ( N / 32 )*32
+ IF( N32.NE.0 ) THEN
+ DO 30 J = 1, N32, 32
+ IX = IX0
+ DO 20 I = I1, I2, INC
+ IP = IPIV( IX )
+ IF( IP.NE.I ) THEN
+ DO 10 K = J, J + 31
+ TEMP = A( I, K )
+ A( I, K ) = A( IP, K )
+ A( IP, K ) = TEMP
+ 10 CONTINUE
+ END IF
+ IX = IX + INCX
+ 20 CONTINUE
+ 30 CONTINUE
+ END IF
+ IF( N32.NE.N ) THEN
+ N32 = N32 + 1
+ IX = IX0
+ DO 50 I = I1, I2, INC
+ IP = IPIV( IX )
+ IF( IP.NE.I ) THEN
+ DO 40 K = N32, N
+ TEMP = A( I, K )
+ A( I, K ) = A( IP, K )
+ A( IP, K ) = TEMP
+ 40 CONTINUE
+ END IF
+ IX = IX + INCX
+ 50 CONTINUE
+ END IF
+*
+ RETURN
+*
+* End of ZLASWP
+*
+ END