|
kusano |
2b45e8 |
SUBROUTINE SLASWPF( N, A, LDA, K1, K2, IPIV, INCX )
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* -- LAPACK auxiliary routine (version 3.0) --
|
|
kusano |
2b45e8 |
* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
|
|
kusano |
2b45e8 |
* Courant Institute, Argonne National Lab, and Rice University
|
|
kusano |
2b45e8 |
* June 30, 1999
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. Scalar Arguments ..
|
|
kusano |
2b45e8 |
INTEGER INCX, K1, K2, LDA, N
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Array Arguments ..
|
|
kusano |
2b45e8 |
INTEGER IPIV( * )
|
|
kusano |
2b45e8 |
REAL A( LDA, * )
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Purpose
|
|
kusano |
2b45e8 |
* =======
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* SLASWP performs a series of row interchanges on the matrix A.
|
|
kusano |
2b45e8 |
* One row interchange is initiated for each of rows K1 through K2 of A.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Arguments
|
|
kusano |
2b45e8 |
* =========
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* N (input) INTEGER
|
|
kusano |
2b45e8 |
* The number of columns of the matrix A.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* A (input/output) REAL array, dimension (LDA,N)
|
|
kusano |
2b45e8 |
* On entry, the matrix of column dimension N to which the row
|
|
kusano |
2b45e8 |
* interchanges will be applied.
|
|
kusano |
2b45e8 |
* On exit, the permuted matrix.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* LDA (input) INTEGER
|
|
kusano |
2b45e8 |
* The leading dimension of the array A.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* K1 (input) INTEGER
|
|
kusano |
2b45e8 |
* The first element of IPIV for which a row interchange will
|
|
kusano |
2b45e8 |
* be done.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* K2 (input) INTEGER
|
|
kusano |
2b45e8 |
* The last element of IPIV for which a row interchange will
|
|
kusano |
2b45e8 |
* be done.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* IPIV (input) INTEGER array, dimension (M*abs(INCX))
|
|
kusano |
2b45e8 |
* The vector of pivot indices. Only the elements in positions
|
|
kusano |
2b45e8 |
* K1 through K2 of IPIV are accessed.
|
|
kusano |
2b45e8 |
* IPIV(K) = L implies rows K and L are to be interchanged.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* INCX (input) INTEGER
|
|
kusano |
2b45e8 |
* The increment between successive values of IPIV. If IPIV
|
|
kusano |
2b45e8 |
* is negative, the pivots are applied in reverse order.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Further Details
|
|
kusano |
2b45e8 |
* ===============
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Modified by
|
|
kusano |
2b45e8 |
* R. C. Whaley, Computer Science Dept., Univ. of Tenn., Knoxville, USA
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* =====================================================================
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* .. Local Scalars ..
|
|
kusano |
2b45e8 |
INTEGER I, I1, I2, INC, IP, IX, IX0, J, K, N32
|
|
kusano |
2b45e8 |
REAL TEMP
|
|
kusano |
2b45e8 |
* ..
|
|
kusano |
2b45e8 |
* .. Executable Statements ..
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* Interchange row I with row IPIV(I) for each of rows K1 through K2.
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
IF( INCX.GT.0 ) THEN
|
|
kusano |
2b45e8 |
IX0 = K1
|
|
kusano |
2b45e8 |
I1 = K1
|
|
kusano |
2b45e8 |
I2 = K2
|
|
kusano |
2b45e8 |
INC = 1
|
|
kusano |
2b45e8 |
ELSE IF( INCX.LT.0 ) THEN
|
|
kusano |
2b45e8 |
IX0 = 1 + ( 1-K2 )*INCX
|
|
kusano |
2b45e8 |
I1 = K2
|
|
kusano |
2b45e8 |
I2 = K1
|
|
kusano |
2b45e8 |
INC = -1
|
|
kusano |
2b45e8 |
ELSE
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
N32 = ( N / 32 )*32
|
|
kusano |
2b45e8 |
IF( N32.NE.0 ) THEN
|
|
kusano |
2b45e8 |
DO 30 J = 1, N32, 32
|
|
kusano |
2b45e8 |
IX = IX0
|
|
kusano |
2b45e8 |
DO 20 I = I1, I2, INC
|
|
kusano |
2b45e8 |
IP = IPIV( IX )
|
|
kusano |
2b45e8 |
IF( IP.NE.I ) THEN
|
|
kusano |
2b45e8 |
DO 10 K = J, J + 31
|
|
kusano |
2b45e8 |
TEMP = A( I, K )
|
|
kusano |
2b45e8 |
A( I, K ) = A( IP, K )
|
|
kusano |
2b45e8 |
A( IP, K ) = TEMP
|
|
kusano |
2b45e8 |
10 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IX = IX + INCX
|
|
kusano |
2b45e8 |
20 CONTINUE
|
|
kusano |
2b45e8 |
30 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IF( N32.NE.N ) THEN
|
|
kusano |
2b45e8 |
N32 = N32 + 1
|
|
kusano |
2b45e8 |
IX = IX0
|
|
kusano |
2b45e8 |
DO 50 I = I1, I2, INC
|
|
kusano |
2b45e8 |
IP = IPIV( IX )
|
|
kusano |
2b45e8 |
IF( IP.NE.I ) THEN
|
|
kusano |
2b45e8 |
DO 40 K = N32, N
|
|
kusano |
2b45e8 |
TEMP = A( I, K )
|
|
kusano |
2b45e8 |
A( I, K ) = A( IP, K )
|
|
kusano |
2b45e8 |
A( IP, K ) = TEMP
|
|
kusano |
2b45e8 |
40 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
IX = IX + INCX
|
|
kusano |
2b45e8 |
50 CONTINUE
|
|
kusano |
2b45e8 |
END IF
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
RETURN
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
* End of SLASWP
|
|
kusano |
2b45e8 |
*
|
|
kusano |
2b45e8 |
END
|