LAPACK  3.10.0
LAPACK: Linear Algebra PACKage

◆ clapmr()

subroutine clapmr ( logical  FORWRD,
integer  M,
integer  N,
complex, dimension( ldx, * )  X,
integer  LDX,
integer, dimension( * )  K 
)

CLAPMR rearranges rows of a matrix as specified by a permutation vector.

Download CLAPMR + dependencies [TGZ] [ZIP] [TXT]

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

      X(K(I),*) is moved X(I,*) for I = 1,2,...,M.

 If FORWRD = .FALSE., backward permutation:

      X(I,*) is moved to X(K(I),*) for I = 1,2,...,M.
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 (M)
          On entry, K contains the permutation vector. K is used as
          internal workspace, but reset to its original value on
          output.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.

Definition at line 103 of file clapmr.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  COMPLEX X( LDX, * )
116 * ..
117 *
118 * =====================================================================
119 *
120 * .. Local Scalars ..
121  INTEGER I, IN, J, JJ
122  COMPLEX TEMP
123 * ..
124 * .. Executable Statements ..
125 *
126  IF( m.LE.1 )
127  $ RETURN
128 *
129  DO 10 i = 1, m
130  k( i ) = -k( i )
131  10 CONTINUE
132 *
133  IF( forwrd ) THEN
134 *
135 * Forward permutation
136 *
137  DO 50 i = 1, m
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 jj = 1, n
151  temp = x( j, jj )
152  x( j, jj ) = x( in, jj )
153  x( in, jj ) = 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  50 CONTINUE
164 *
165  ELSE
166 *
167 * Backward permutation
168 *
169  DO 90 i = 1, m
170 *
171  IF( k( i ).GT.0 )
172  $ GO TO 80
173 *
174  k( i ) = -k( i )
175  j = k( i )
176  60 CONTINUE
177  IF( j.EQ.i )
178  $ GO TO 80
179 *
180  DO 70 jj = 1, n
181  temp = x( i, jj )
182  x( i, jj ) = x( j, jj )
183  x( j, jj ) = temp
184  70 CONTINUE
185 *
186  k( j ) = -k( j )
187  j = k( j )
188  GO TO 60
189 *
190  80 CONTINUE
191 *
192  90 CONTINUE
193 *
194  END IF
195 *
196  RETURN
197 *
198 * End of CLAPMR
199 *
Here is the caller graph for this function: