Purpose
To perform a series of column interchanges on the matrix A. One column interchange is initiated for each of columns K1 through K2 of A. This is useful for solving linear systems X*A = B, when the matrix A has already been factored by LAPACK Library routine DGETRF.Specification
SUBROUTINE MA02GD( N, A, LDA, K1, K2, IPIV, INCX )
C .. Scalar Arguments ..
INTEGER INCX, K1, K2, LDA, N
C .. Array Arguments ..
INTEGER IPIV( * )
DOUBLE PRECISION A( LDA, * )
Arguments
Input/Output Parameters
N (input) INTEGER
The number of rows of the matrix A. N >= 0.
A (input/output) DOUBLE PRECISION array, dimension (LDA,*)
On entry, the leading N-by-M part of this array must
contain the matrix A to which the column interchanges will
be applied, where M is the largest element of IPIV(K), for
K = K1, ..., K2.
On exit, the leading N-by-M part of this array contains
the permuted matrix.
LDA INTEGER
The leading dimension of the array A. LDA >= MAX(1,N).
K1 (input) INTEGER
The first element of IPIV for which a column interchange
will be done.
K2 (input) INTEGER
The last element of IPIV for which a column interchange
will be done.
IPIV (input) INTEGER array, dimension (K1+(K2-K1)*abs(INCX))
The vector of interchanging (pivot) indices. Only the
elements in positions K1 through K2 of IPIV are accessed.
IPIV(K) = L implies columns K and L are to be
interchanged.
INCX (input) INTEGER
The increment between successive values of IPIV.
If INCX is negative, the interchanges are applied in
reverse order.
Method
The columns IPIV(K) and K are swapped for K = K1, ..., K2, for INCX = 1 (and similarly, for INCX <> 1).Further Comments
This routine is the column-oriented counterpart of the LAPACK
Library routine DLASWP. The LAPACK Library routine DLAPMT cannot
be used in this context. To solve the system X*A = B, where A and
B are N-by-N and M-by-N, respectively, the following statements
can be used:
CALL DGETRF( N, N, A, LDA, IPIV, INFO )
CALL DTRSM( 'R', 'U', 'N', 'N', M, N, ONE, A, LDA, B, LDB )
CALL DTRSM( 'R', 'L', 'N', 'U', M, N, ONE, A, LDA, B, LDB )
CALL MA02GD( M, B, LDB, 1, N, IPIV, -1 )
Example
Program Text
NoneProgram Data
NoneProgram Results
None