LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ zlapmr()

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

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

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

Purpose:
 ZLAPMR 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*16 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.
Date
December 2016

Definition at line 106 of file zlapmr.f.

106 *
107 * -- LAPACK auxiliary routine (version 3.7.0) --
108 * -- LAPACK is a software package provided by Univ. of Tennessee, --
109 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
110 * December 2016
111 *
112 * .. Scalar Arguments ..
113  LOGICAL forwrd
114  INTEGER ldx, m, n
115 * ..
116 * .. Array Arguments ..
117  INTEGER k( * )
118  COMPLEX*16 x( ldx, * )
119 * ..
120 *
121 * =====================================================================
122 *
123 * .. Local Scalars ..
124  INTEGER i, in, j, jj
125  COMPLEX*16 temp
126 * ..
127 * .. Executable Statements ..
128 *
129  IF( m.LE.1 )
130  $ RETURN
131 *
132  DO 10 i = 1, m
133  k( i ) = -k( i )
134  10 CONTINUE
135 *
136  IF( forwrd ) THEN
137 *
138 * Forward permutation
139 *
140  DO 50 i = 1, m
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 jj = 1, n
154  temp = x( j, jj )
155  x( j, jj ) = x( in, jj )
156  x( in, jj ) = 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  50 CONTINUE
167 *
168  ELSE
169 *
170 * Backward permutation
171 *
172  DO 90 i = 1, m
173 *
174  IF( k( i ).GT.0 )
175  $ GO TO 80
176 *
177  k( i ) = -k( i )
178  j = k( i )
179  60 CONTINUE
180  IF( j.EQ.i )
181  $ GO TO 80
182 *
183  DO 70 jj = 1, n
184  temp = x( i, jj )
185  x( i, jj ) = x( j, jj )
186  x( j, jj ) = temp
187  70 CONTINUE
188 *
189  k( j ) = -k( j )
190  j = k( j )
191  GO TO 60
192 *
193  80 CONTINUE
194 *
195  90 CONTINUE
196 *
197  END IF
198 *
199  RETURN
200 *
201 * End of ZLAPMT
202 *
Here is the caller graph for this function: