LAPACK  3.6.1 LAPACK: Linear Algebra PACKage
 subroutine clapmt ( logical FORWRD, integer M, integer N, complex, dimension( ldx, * ) X, integer LDX, integer, dimension( * ) K )

CLAPMT performs a forward or backward permutation of the columns of a matrix.

Purpose:
``` CLAPMT rearranges the columns of the M by N matrix X as specified
by the permutation K(1),K(2),...,K(N) of the integers 1,...,N.
If FORWRD = .TRUE.,  forward permutation:

X(*,K(J)) is moved X(*,J) for J = 1,2,...,N.

If FORWRD = .FALSE., backward permutation:

X(*,J) is moved to X(*,K(J)) for J = 1,2,...,N.```
Parameters
 [in] FORWRD ``` FORWRD is LOGICAL = .TRUE., forward permutation = .FALSE., backward permutation``` [in] M ``` M is INTEGER The number of rows of the matrix X. M >= 0.``` [in] N ``` N is INTEGER The number of columns of the matrix X. N >= 0.``` [in,out] X ``` X is COMPLEX array, dimension (LDX,N) On entry, the M by N matrix X. On exit, X contains the permuted matrix X.``` [in] LDX ``` LDX is INTEGER The leading dimension of the array X, LDX >= MAX(1,M).``` [in,out] K ``` K is INTEGER array, dimension (N) On entry, K contains the permutation vector. K is used as internal workspace, but reset to its original value on output.```
Date
September 2012

Definition at line 106 of file clapmt.f.

106 *
107 * -- LAPACK auxiliary routine (version 3.4.2) --
108 * -- LAPACK is a software package provided by Univ. of Tennessee, --
109 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110 * September 2012
111 *
112 * .. Scalar Arguments ..
113  LOGICAL forwrd
114  INTEGER ldx, m, n
115 * ..
116 * .. Array Arguments ..
117  INTEGER k( * )
118  COMPLEX x( ldx, * )
119 * ..
120 *
121 * =====================================================================
122 *
123 * .. Local Scalars ..
124  INTEGER i, ii, j, in
125  COMPLEX temp
126 * ..
127 * .. Executable Statements ..
128 *
129  IF( n.LE.1 )
130  \$ RETURN
131 *
132  DO 10 i = 1, n
133  k( i ) = -k( i )
134  10 CONTINUE
135 *
136  IF( forwrd ) THEN
137 *
138 * Forward permutation
139 *
140  DO 60 i = 1, n
141 *
142  IF( k( i ).GT.0 )
143  \$ GO TO 40
144 *
145  j = i
146  k( j ) = -k( j )
147  in = k( j )
148 *
149  20 CONTINUE
150  IF( k( in ).GT.0 )
151  \$ GO TO 40
152 *
153  DO 30 ii = 1, m
154  temp = x( ii, j )
155  x( ii, j ) = x( ii, in )
156  x( ii, in ) = temp
157  30 CONTINUE
158 *
159  k( in ) = -k( in )
160  j = in
161  in = k( in )
162  GO TO 20
163 *
164  40 CONTINUE
165 *
166  60 CONTINUE
167 *
168  ELSE
169 *
170 * Backward permutation
171 *
172  DO 110 i = 1, n
173 *
174  IF( k( i ).GT.0 )
175  \$ GO TO 100
176 *
177  k( i ) = -k( i )
178  j = k( i )
179  80 CONTINUE
180  IF( j.EQ.i )
181  \$ GO TO 100
182 *
183  DO 90 ii = 1, m
184  temp = x( ii, i )
185  x( ii, i ) = x( ii, j )
186  x( ii, j ) = temp
187  90 CONTINUE
188 *
189  k( j ) = -k( j )
190  j = k( j )
191  GO TO 80
192 *
193  100 CONTINUE
194
195  110 CONTINUE
196 *
197  END IF
198 *
199  RETURN
200 *
201 * End of CLAPMT
202 *

Here is the caller graph for this function: