LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
csyconvf_rook.f
Go to the documentation of this file.
1*> \brief \b CSYCONVF_ROOK
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download CSYCONVF_ROOK + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/csyconvf_rook.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/csyconvf_rook.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/csyconvf_rook.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* SUBROUTINE CSYCONVF_ROOK( UPLO, WAY, N, A, LDA, E, IPIV, INFO )
20*
21* .. Scalar Arguments ..
22* CHARACTER UPLO, WAY
23* INTEGER INFO, LDA, N
24* ..
25* .. Array Arguments ..
26* INTEGER IPIV( * )
27* COMPLEX A( LDA, * ), E( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*> If parameter WAY = 'C':
36*> CSYCONVF_ROOK converts the factorization output format used in
37*> CSYTRF_ROOK provided on entry in parameter A into the factorization
38*> output format used in CSYTRF_RK (or CSYTRF_BK) that is stored
39*> on exit in parameters A and E. IPIV format for CSYTRF_ROOK and
40*> CSYTRF_RK (or CSYTRF_BK) is the same and is not converted.
41*>
42*> If parameter WAY = 'R':
43*> CSYCONVF_ROOK performs the conversion in reverse direction, i.e.
44*> converts the factorization output format used in CSYTRF_RK
45*> (or CSYTRF_BK) provided on entry in parameters A and E into
46*> the factorization output format used in CSYTRF_ROOK that is stored
47*> on exit in parameter A. IPIV format for CSYTRF_ROOK and
48*> CSYTRF_RK (or CSYTRF_BK) is the same and is not converted.
49*>
50*> CSYCONVF_ROOK can also convert in Hermitian matrix case, i.e. between
51*> formats used in CHETRF_ROOK and CHETRF_RK (or CHETRF_BK).
52*> \endverbatim
53*
54* Arguments:
55* ==========
56*
57*> \param[in] UPLO
58*> \verbatim
59*> UPLO is CHARACTER*1
60*> Specifies whether the details of the factorization are
61*> stored as an upper or lower triangular matrix A.
62*> = 'U': Upper triangular
63*> = 'L': Lower triangular
64*> \endverbatim
65*>
66*> \param[in] WAY
67*> \verbatim
68*> WAY is CHARACTER*1
69*> = 'C': Convert
70*> = 'R': Revert
71*> \endverbatim
72*>
73*> \param[in] N
74*> \verbatim
75*> N is INTEGER
76*> The order of the matrix A. N >= 0.
77*> \endverbatim
78*>
79*> \param[in,out] A
80*> \verbatim
81*> A is COMPLEX array, dimension (LDA,N)
82*>
83*> 1) If WAY ='C':
84*>
85*> On entry, contains factorization details in format used in
86*> CSYTRF_ROOK:
87*> a) all elements of the symmetric block diagonal
88*> matrix D on the diagonal of A and on superdiagonal
89*> (or subdiagonal) of A, and
90*> b) If UPLO = 'U': multipliers used to obtain factor U
91*> in the superdiagonal part of A.
92*> If UPLO = 'L': multipliers used to obtain factor L
93*> in the superdiagonal part of A.
94*>
95*> On exit, contains factorization details in format used in
96*> CSYTRF_RK or CSYTRF_BK:
97*> a) ONLY diagonal elements of the symmetric block diagonal
98*> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
99*> (superdiagonal (or subdiagonal) elements of D
100*> are stored on exit in array E), and
101*> b) If UPLO = 'U': factor U in the superdiagonal part of A.
102*> If UPLO = 'L': factor L in the subdiagonal part of A.
103*>
104*> 2) If WAY = 'R':
105*>
106*> On entry, contains factorization details in format used in
107*> CSYTRF_RK or CSYTRF_BK:
108*> a) ONLY diagonal elements of the symmetric block diagonal
109*> matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
110*> (superdiagonal (or subdiagonal) elements of D
111*> are stored on exit in array E), and
112*> b) If UPLO = 'U': factor U in the superdiagonal part of A.
113*> If UPLO = 'L': factor L in the subdiagonal part of A.
114*>
115*> On exit, contains factorization details in format used in
116*> CSYTRF_ROOK:
117*> a) all elements of the symmetric block diagonal
118*> matrix D on the diagonal of A and on superdiagonal
119*> (or subdiagonal) of A, and
120*> b) If UPLO = 'U': multipliers used to obtain factor U
121*> in the superdiagonal part of A.
122*> If UPLO = 'L': multipliers used to obtain factor L
123*> in the superdiagonal part of A.
124*> \endverbatim
125*>
126*> \param[in] LDA
127*> \verbatim
128*> LDA is INTEGER
129*> The leading dimension of the array A. LDA >= max(1,N).
130*> \endverbatim
131*>
132*> \param[in,out] E
133*> \verbatim
134*> E is COMPLEX array, dimension (N)
135*>
136*> 1) If WAY ='C':
137*>
138*> On entry, just a workspace.
139*>
140*> On exit, contains the superdiagonal (or subdiagonal)
141*> elements of the symmetric block diagonal matrix D
142*> with 1-by-1 or 2-by-2 diagonal blocks, where
143*> If UPLO = 'U': E(i) = D(i-1,i), i=2:N, E(1) is set to 0;
144*> If UPLO = 'L': E(i) = D(i+1,i), i=1:N-1, E(N) is set to 0.
145*>
146*> 2) If WAY = 'R':
147*>
148*> On entry, contains the superdiagonal (or subdiagonal)
149*> elements of the symmetric block diagonal matrix D
150*> with 1-by-1 or 2-by-2 diagonal blocks, where
151*> If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced;
152*> If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced.
153*>
154*> On exit, is not changed
155*> \endverbatim
156*.
157*> \param[in] IPIV
158*> \verbatim
159*> IPIV is INTEGER array, dimension (N)
160*> On entry, details of the interchanges and the block
161*> structure of D as determined:
162*> 1) by CSYTRF_ROOK, if WAY ='C';
163*> 2) by CSYTRF_RK (or CSYTRF_BK), if WAY ='R'.
164*> The IPIV format is the same for all these routines.
165*>
166*> On exit, is not changed.
167*> \endverbatim
168*>
169*> \param[out] INFO
170*> \verbatim
171*> INFO is INTEGER
172*> = 0: successful exit
173*> < 0: if INFO = -i, the i-th argument had an illegal value
174*> \endverbatim
175*
176* Authors:
177* ========
178*
179*> \author Univ. of Tennessee
180*> \author Univ. of California Berkeley
181*> \author Univ. of Colorado Denver
182*> \author NAG Ltd.
183*
184*> \ingroup syconvf_rook
185*
186*> \par Contributors:
187* ==================
188*>
189*> \verbatim
190*>
191*> November 2017, Igor Kozachenko,
192*> Computer Science Division,
193*> University of California, Berkeley
194*>
195*> \endverbatim
196* =====================================================================
197 SUBROUTINE csyconvf_rook( UPLO, WAY, N, A, LDA, E, IPIV, INFO )
198*
199* -- LAPACK computational routine --
200* -- LAPACK is a software package provided by Univ. of Tennessee, --
201* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
202*
203* .. Scalar Arguments ..
204 CHARACTER UPLO, WAY
205 INTEGER INFO, LDA, N
206* ..
207* .. Array Arguments ..
208 INTEGER IPIV( * )
209 COMPLEX A( LDA, * ), E( * )
210* ..
211*
212* =====================================================================
213*
214* .. Parameters ..
215 COMPLEX ZERO
216 parameter( zero = ( 0.0e+0, 0.0e+0 ) )
217* ..
218* .. External Functions ..
219 LOGICAL LSAME
220 EXTERNAL lsame
221*
222* .. External Subroutines ..
223 EXTERNAL cswap, xerbla
224* .. Local Scalars ..
225 LOGICAL UPPER, CONVERT
226 INTEGER I, IP, IP2
227* ..
228* .. Executable Statements ..
229*
230 info = 0
231 upper = lsame( uplo, 'U' )
232 convert = lsame( way, 'C' )
233 IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
234 info = -1
235 ELSE IF( .NOT.convert .AND. .NOT.lsame( way, 'R' ) ) THEN
236 info = -2
237 ELSE IF( n.LT.0 ) THEN
238 info = -3
239 ELSE IF( lda.LT.max( 1, n ) ) THEN
240 info = -5
241
242 END IF
243 IF( info.NE.0 ) THEN
244 CALL xerbla( 'CSYCONVF_ROOK', -info )
245 RETURN
246 END IF
247*
248* Quick return if possible
249*
250 IF( n.EQ.0 )
251 $ RETURN
252*
253 IF( upper ) THEN
254*
255* Begin A is UPPER
256*
257 IF ( convert ) THEN
258*
259* Convert A (A is upper)
260*
261*
262* Convert VALUE
263*
264* Assign superdiagonal entries of D to array E and zero out
265* corresponding entries in input storage A
266*
267 i = n
268 e( 1 ) = zero
269 DO WHILE ( i.GT.1 )
270 IF( ipiv( i ).LT.0 ) THEN
271 e( i ) = a( i-1, i )
272 e( i-1 ) = zero
273 a( i-1, i ) = zero
274 i = i - 1
275 ELSE
276 e( i ) = zero
277 END IF
278 i = i - 1
279 END DO
280*
281* Convert PERMUTATIONS
282*
283* Apply permutations to submatrices of upper part of A
284* in factorization order where i decreases from N to 1
285*
286 i = n
287 DO WHILE ( i.GE.1 )
288 IF( ipiv( i ).GT.0 ) THEN
289*
290* 1-by-1 pivot interchange
291*
292* Swap rows i and IPIV(i) in A(1:i,N-i:N)
293*
294 ip = ipiv( i )
295 IF( i.LT.n ) THEN
296 IF( ip.NE.i ) THEN
297 CALL cswap( n-i, a( i, i+1 ), lda,
298 $ a( ip, i+1 ), lda )
299 END IF
300 END IF
301*
302 ELSE
303*
304* 2-by-2 pivot interchange
305*
306* Swap rows i and IPIV(i) and i-1 and IPIV(i-1)
307* in A(1:i,N-i:N)
308*
309 ip = -ipiv( i )
310 ip2 = -ipiv( i-1 )
311 IF( i.LT.n ) THEN
312 IF( ip.NE.i ) THEN
313 CALL cswap( n-i, a( i, i+1 ), lda,
314 $ a( ip, i+1 ), lda )
315 END IF
316 IF( ip2.NE.(i-1) ) THEN
317 CALL cswap( n-i, a( i-1, i+1 ), lda,
318 $ a( ip2, i+1 ), lda )
319 END IF
320 END IF
321 i = i - 1
322*
323 END IF
324 i = i - 1
325 END DO
326*
327 ELSE
328*
329* Revert A (A is upper)
330*
331*
332* Revert PERMUTATIONS
333*
334* Apply permutations to submatrices of upper part of A
335* in reverse factorization order where i increases from 1 to N
336*
337 i = 1
338 DO WHILE ( i.LE.n )
339 IF( ipiv( i ).GT.0 ) THEN
340*
341* 1-by-1 pivot interchange
342*
343* Swap rows i and IPIV(i) in A(1:i,N-i:N)
344*
345 ip = ipiv( i )
346 IF( i.LT.n ) THEN
347 IF( ip.NE.i ) THEN
348 CALL cswap( n-i, a( ip, i+1 ), lda,
349 $ a( i, i+1 ), lda )
350 END IF
351 END IF
352*
353 ELSE
354*
355* 2-by-2 pivot interchange
356*
357* Swap rows i-1 and IPIV(i-1) and i and IPIV(i)
358* in A(1:i,N-i:N)
359*
360 i = i + 1
361 ip = -ipiv( i )
362 ip2 = -ipiv( i-1 )
363 IF( i.LT.n ) THEN
364 IF( ip2.NE.(i-1) ) THEN
365 CALL cswap( n-i, a( ip2, i+1 ), lda,
366 $ a( i-1, i+1 ), lda )
367 END IF
368 IF( ip.NE.i ) THEN
369 CALL cswap( n-i, a( ip, i+1 ), lda,
370 $ a( i, i+1 ), lda )
371 END IF
372 END IF
373*
374 END IF
375 i = i + 1
376 END DO
377*
378* Revert VALUE
379* Assign superdiagonal entries of D from array E to
380* superdiagonal entries of A.
381*
382 i = n
383 DO WHILE ( i.GT.1 )
384 IF( ipiv( i ).LT.0 ) THEN
385 a( i-1, i ) = e( i )
386 i = i - 1
387 END IF
388 i = i - 1
389 END DO
390*
391* End A is UPPER
392*
393 END IF
394*
395 ELSE
396*
397* Begin A is LOWER
398*
399 IF ( convert ) THEN
400*
401* Convert A (A is lower)
402*
403*
404* Convert VALUE
405* Assign subdiagonal entries of D to array E and zero out
406* corresponding entries in input storage A
407*
408 i = 1
409 e( n ) = zero
410 DO WHILE ( i.LE.n )
411 IF( i.LT.n .AND. ipiv(i).LT.0 ) THEN
412 e( i ) = a( i+1, i )
413 e( i+1 ) = zero
414 a( i+1, i ) = zero
415 i = i + 1
416 ELSE
417 e( i ) = zero
418 END IF
419 i = i + 1
420 END DO
421*
422* Convert PERMUTATIONS
423*
424* Apply permutations to submatrices of lower part of A
425* in factorization order where i increases from 1 to N
426*
427 i = 1
428 DO WHILE ( i.LE.n )
429 IF( ipiv( i ).GT.0 ) THEN
430*
431* 1-by-1 pivot interchange
432*
433* Swap rows i and IPIV(i) in A(i:N,1:i-1)
434*
435 ip = ipiv( i )
436 IF ( i.GT.1 ) THEN
437 IF( ip.NE.i ) THEN
438 CALL cswap( i-1, a( i, 1 ), lda,
439 $ a( ip, 1 ), lda )
440 END IF
441 END IF
442*
443 ELSE
444*
445* 2-by-2 pivot interchange
446*
447* Swap rows i and IPIV(i) and i+1 and IPIV(i+1)
448* in A(i:N,1:i-1)
449*
450 ip = -ipiv( i )
451 ip2 = -ipiv( i+1 )
452 IF ( i.GT.1 ) THEN
453 IF( ip.NE.i ) THEN
454 CALL cswap( i-1, a( i, 1 ), lda,
455 $ a( ip, 1 ), lda )
456 END IF
457 IF( ip2.NE.(i+1) ) THEN
458 CALL cswap( i-1, a( i+1, 1 ), lda,
459 $ a( ip2, 1 ), lda )
460 END IF
461 END IF
462 i = i + 1
463*
464 END IF
465 i = i + 1
466 END DO
467*
468 ELSE
469*
470* Revert A (A is lower)
471*
472*
473* Revert PERMUTATIONS
474*
475* Apply permutations to submatrices of lower part of A
476* in reverse factorization order where i decreases from N to 1
477*
478 i = n
479 DO WHILE ( i.GE.1 )
480 IF( ipiv( i ).GT.0 ) THEN
481*
482* 1-by-1 pivot interchange
483*
484* Swap rows i and IPIV(i) in A(i:N,1:i-1)
485*
486 ip = ipiv( i )
487 IF ( i.GT.1 ) THEN
488 IF( ip.NE.i ) THEN
489 CALL cswap( i-1, a( ip, 1 ), lda,
490 $ a( i, 1 ), lda )
491 END IF
492 END IF
493*
494 ELSE
495*
496* 2-by-2 pivot interchange
497*
498* Swap rows i+1 and IPIV(i+1) and i and IPIV(i)
499* in A(i:N,1:i-1)
500*
501 i = i - 1
502 ip = -ipiv( i )
503 ip2 = -ipiv( i+1 )
504 IF ( i.GT.1 ) THEN
505 IF( ip2.NE.(i+1) ) THEN
506 CALL cswap( i-1, a( ip2, 1 ), lda,
507 $ a( i+1, 1 ), lda )
508 END IF
509 IF( ip.NE.i ) THEN
510 CALL cswap( i-1, a( ip, 1 ), lda,
511 $ a( i, 1 ), lda )
512 END IF
513 END IF
514*
515 END IF
516 i = i - 1
517 END DO
518*
519* Revert VALUE
520* Assign subdiagonal entries of D from array E to
521* subdiagonal entries of A.
522*
523 i = 1
524 DO WHILE ( i.LE.n-1 )
525 IF( ipiv( i ).LT.0 ) THEN
526 a( i + 1, i ) = e( i )
527 i = i + 1
528 END IF
529 i = i + 1
530 END DO
531*
532 END IF
533*
534* End A is LOWER
535*
536 END IF
537
538 RETURN
539*
540* End of CSYCONVF_ROOK
541*
542 END
subroutine xerbla(srname, info)
Definition cblat2.f:3285
subroutine cswap(n, cx, incx, cy, incy)
CSWAP
Definition cswap.f:81
subroutine csyconvf_rook(uplo, way, n, a, lda, e, ipiv, info)
CSYCONVF_ROOK