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