 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

## ◆ slapmt()

 subroutine slapmt ( logical FORWRD, integer M, integer N, real, dimension( ldx, * ) X, integer LDX, integer, dimension( * ) K )

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

Purpose:
``` SLAPMT 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 REAL 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.```

Definition at line 103 of file slapmt.f.

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