LAPACK  3.8.0
LAPACK: Linear Algebra PACKage

◆ csyconvf()

subroutine csyconvf ( character  UPLO,
character  WAY,
integer  N,
complex, dimension( lda, * )  A,
integer  LDA,
complex, dimension( * )  E,
integer, dimension( * )  IPIV,
integer  INFO 
)

CSYCONVF

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

Purpose:
 If parameter WAY = 'C':
 CSYCONVF converts the factorization output format used in
 CSYTRF provided on entry in parameter A into the factorization
 output format used in CSYTRF_RK (or CSYTRF_BK) that is stored
 on exit in parameters A and E. It also coverts in place details of
 the intechanges stored in IPIV from the format used in CSYTRF into
 the format used in CSYTRF_RK (or CSYTRF_BK).

 If parameter WAY = 'R':
 CSYCONVF performs the conversion in reverse direction, i.e.
 converts the factorization output format used in CSYTRF_RK
 (or CSYTRF_BK) provided on entry in parameters A and E into
 the factorization output format used in CSYTRF that is stored
 on exit in parameter A. It also coverts in place details of
 the intechanges stored in IPIV from the format used in CSYTRF_RK
 (or CSYTRF_BK) into the format used in CSYTRF.

 CSYCONVF can also convert in Hermitian matrix case, i.e. between
 formats used in CHETRF and CHETRF_RK (or CHETRF_BK).
Parameters
[in]UPLO
          UPLO is CHARACTER*1
          Specifies whether the details of the factorization are
          stored as an upper or lower triangular matrix A.
          = 'U':  Upper triangular
          = 'L':  Lower triangular
[in]WAY
          WAY is CHARACTER*1
          = 'C': Convert
          = 'R': Revert
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is COMPLEX array, dimension (LDA,N)

          1) If WAY ='C':

          On entry, contains factorization details in format used in
          CSYTRF:
            a) all elements of the symmetric block diagonal
               matrix D on the diagonal of A and on superdiagonal
               (or subdiagonal) of A, and
            b) If UPLO = 'U': multipliers used to obtain factor U
               in the superdiagonal part of A.
               If UPLO = 'L': multipliers used to obtain factor L
               in the superdiagonal part of A.

          On exit, contains factorization details in format used in
          CSYTRF_RK or CSYTRF_BK:
            a) ONLY diagonal elements of the symmetric block diagonal
               matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
               (superdiagonal (or subdiagonal) elements of D
                are stored on exit in array E), and
            b) If UPLO = 'U': factor U in the superdiagonal part of A.
               If UPLO = 'L': factor L in the subdiagonal part of A.

          2) If WAY = 'R':

          On entry, contains factorization details in format used in
          CSYTRF_RK or CSYTRF_BK:
            a) ONLY diagonal elements of the symmetric block diagonal
               matrix D on the diagonal of A, i.e. D(k,k) = A(k,k);
               (superdiagonal (or subdiagonal) elements of D
                are stored on exit in array E), and
            b) If UPLO = 'U': factor U in the superdiagonal part of A.
               If UPLO = 'L': factor L in the subdiagonal part of A.

          On exit, contains factorization details in format used in
          CSYTRF:
            a) all elements of the symmetric block diagonal
               matrix D on the diagonal of A and on superdiagonal
               (or subdiagonal) of A, and
            b) If UPLO = 'U': multipliers used to obtain factor U
               in the superdiagonal part of A.
               If UPLO = 'L': multipliers used to obtain factor L
               in the superdiagonal part of A.
[in]LDA
          LDA is INTEGER
          The leading dimension of the array A.  LDA >= max(1,N).
[in,out]E
          E is COMPLEX array, dimension (N)

          1) If WAY ='C':

          On entry, just a workspace.

          On exit, contains the superdiagonal (or subdiagonal)
          elements of the symmetric block diagonal matrix D
          with 1-by-1 or 2-by-2 diagonal blocks, where
          If UPLO = 'U': E(i) = D(i-1,i), i=2:N, E(1) is set to 0;
          If UPLO = 'L': E(i) = D(i+1,i), i=1:N-1, E(N) is set to 0.

          2) If WAY = 'R':

          On entry, contains the superdiagonal (or subdiagonal)
          elements of the symmetric block diagonal matrix D
          with 1-by-1 or 2-by-2 diagonal blocks, where
          If UPLO = 'U': E(i) = D(i-1,i),i=2:N, E(1) not referenced;
          If UPLO = 'L': E(i) = D(i+1,i),i=1:N-1, E(N) not referenced.

          On exit, is not changed
[in,out]IPIV
          IPIV is INTEGER array, dimension (N)

          1) If WAY ='C':
          On entry, details of the interchanges and the block
          structure of D in the format used in CSYTRF.
          On exit, details of the interchanges and the block
          structure of D in the format used in CSYTRF_RK
          ( or CSYTRF_BK).

          1) If WAY ='R':
          On entry, details of the interchanges and the block
          structure of D in the format used in CSYTRF_RK
          ( or CSYTRF_BK).
          On exit, details of the interchanges and the block
          structure of D in the format used in CSYTRF.
[out]INFO
          INFO is INTEGER
          = 0:  successful exit
          < 0:  if INFO = -i, the i-th argument had an illegal value
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017
Contributors:
  November 2017,  Igor Kozachenko,
                  Computer Science Division,
                  University of California, Berkeley

Definition at line 211 of file csyconvf.f.

211 *
212 * -- LAPACK computational routine (version 3.8.0) --
213 * -- LAPACK is a software package provided by Univ. of Tennessee, --
214 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
215 * November 2017
216 *
217 * .. Scalar Arguments ..
218  CHARACTER uplo, way
219  INTEGER info, lda, n
220 * ..
221 * .. Array Arguments ..
222  INTEGER ipiv( * )
223  COMPLEX a( lda, * ), e( * )
224 * ..
225 *
226 * =====================================================================
227 *
228 * .. Parameters ..
229  COMPLEX zero
230  parameter( zero = ( 0.0e+0, 0.0e+0 ) )
231 * ..
232 * .. External Functions ..
233  LOGICAL lsame
234  EXTERNAL lsame
235 *
236 * .. External Subroutines ..
237  EXTERNAL cswap, xerbla
238 * .. Local Scalars ..
239  LOGICAL upper, convert
240  INTEGER i, ip
241 * ..
242 * .. Executable Statements ..
243 *
244  info = 0
245  upper = lsame( uplo, 'U' )
246  convert = lsame( way, 'C' )
247  IF( .NOT.upper .AND. .NOT.lsame( uplo, 'L' ) ) THEN
248  info = -1
249  ELSE IF( .NOT.convert .AND. .NOT.lsame( way, 'R' ) ) THEN
250  info = -2
251  ELSE IF( n.LT.0 ) THEN
252  info = -3
253  ELSE IF( lda.LT.max( 1, n ) ) THEN
254  info = -5
255 
256  END IF
257  IF( info.NE.0 ) THEN
258  CALL xerbla( 'CSYCONVF', -info )
259  RETURN
260  END IF
261 *
262 * Quick return if possible
263 *
264  IF( n.EQ.0 )
265  $ RETURN
266 *
267  IF( upper ) THEN
268 *
269 * Begin A is UPPER
270 *
271  IF ( convert ) THEN
272 *
273 * Convert A (A is upper)
274 *
275 *
276 * Convert VALUE
277 *
278 * Assign superdiagonal entries of D to array E and zero out
279 * corresponding entries in input storage A
280 *
281  i = n
282  e( 1 ) = zero
283  DO WHILE ( i.GT.1 )
284  IF( ipiv( i ).LT.0 ) THEN
285  e( i ) = a( i-1, i )
286  e( i-1 ) = zero
287  a( i-1, i ) = zero
288  i = i - 1
289  ELSE
290  e( i ) = zero
291  END IF
292  i = i - 1
293  END DO
294 *
295 * Convert PERMUTATIONS and IPIV
296 *
297 * Apply permutaions to submatrices of upper part of A
298 * in factorization order where i decreases from N to 1
299 *
300  i = n
301  DO WHILE ( i.GE.1 )
302  IF( ipiv( i ).GT.0 ) THEN
303 *
304 * 1-by-1 pivot interchange
305 *
306 * Swap rows i and IPIV(i) in A(1:i,N-i:N)
307 *
308  ip = ipiv( i )
309  IF( i.LT.n ) THEN
310  IF( ip.NE.i ) THEN
311  CALL cswap( n-i, a( i, i+1 ), lda,
312  $ a( ip, i+1 ), lda )
313  END IF
314  END IF
315 *
316  ELSE
317 *
318 * 2-by-2 pivot interchange
319 *
320 * Swap rows i-1 and IPIV(i) in A(1:i,N-i:N)
321 *
322  ip = -ipiv( i )
323  IF( i.LT.n ) THEN
324  IF( ip.NE.(i-1) ) THEN
325  CALL cswap( n-i, a( i-1, i+1 ), lda,
326  $ a( ip, i+1 ), lda )
327  END IF
328  END IF
329 *
330 * Convert IPIV
331 * There is no interchnge of rows i and and IPIV(i),
332 * so this should be reflected in IPIV format for
333 * *SYTRF_RK ( or *SYTRF_BK)
334 *
335  ipiv( i ) = i
336 *
337  i = i - 1
338 *
339  END IF
340  i = i - 1
341  END DO
342 *
343  ELSE
344 *
345 * Revert A (A is upper)
346 *
347 *
348 * Revert PERMUTATIONS and IPIV
349 *
350 * Apply permutaions to submatrices of upper part of A
351 * in reverse factorization order where i increases from 1 to N
352 *
353  i = 1
354  DO WHILE ( i.LE.n )
355  IF( ipiv( i ).GT.0 ) THEN
356 *
357 * 1-by-1 pivot interchange
358 *
359 * Swap rows i and IPIV(i) in A(1:i,N-i:N)
360 *
361  ip = ipiv( i )
362  IF( i.LT.n ) THEN
363  IF( ip.NE.i ) THEN
364  CALL cswap( n-i, a( ip, i+1 ), lda,
365  $ a( i, i+1 ), lda )
366  END IF
367  END IF
368 *
369  ELSE
370 *
371 * 2-by-2 pivot interchange
372 *
373 * Swap rows i-1 and IPIV(i) in A(1:i,N-i:N)
374 *
375  i = i + 1
376  ip = -ipiv( i )
377  IF( i.LT.n ) THEN
378  IF( ip.NE.(i-1) ) THEN
379  CALL cswap( n-i, a( ip, i+1 ), lda,
380  $ a( i-1, i+1 ), lda )
381  END IF
382  END IF
383 *
384 * Convert IPIV
385 * There is one interchange of rows i-1 and IPIV(i-1),
386 * so this should be recorded in two consecutive entries
387 * in IPIV format for *SYTRF
388 *
389  ipiv( i ) = ipiv( i-1 )
390 *
391  END IF
392  i = i + 1
393  END DO
394 *
395 * Revert VALUE
396 * Assign superdiagonal entries of D from array E to
397 * superdiagonal entries of A.
398 *
399  i = n
400  DO WHILE ( i.GT.1 )
401  IF( ipiv( i ).LT.0 ) THEN
402  a( i-1, i ) = e( i )
403  i = i - 1
404  END IF
405  i = i - 1
406  END DO
407 *
408 * End A is UPPER
409 *
410  END IF
411 *
412  ELSE
413 *
414 * Begin A is LOWER
415 *
416  IF ( convert ) THEN
417 *
418 * Convert A (A is lower)
419 *
420 *
421 * Convert VALUE
422 * Assign subdiagonal entries of D to array E and zero out
423 * corresponding entries in input storage A
424 *
425  i = 1
426  e( n ) = zero
427  DO WHILE ( i.LE.n )
428  IF( i.LT.n .AND. ipiv(i).LT.0 ) THEN
429  e( i ) = a( i+1, i )
430  e( i+1 ) = zero
431  a( i+1, i ) = zero
432  i = i + 1
433  ELSE
434  e( i ) = zero
435  END IF
436  i = i + 1
437  END DO
438 *
439 * Convert PERMUTATIONS and IPIV
440 *
441 * Apply permutaions to submatrices of lower part of A
442 * in factorization order where k increases from 1 to N
443 *
444  i = 1
445  DO WHILE ( i.LE.n )
446  IF( ipiv( i ).GT.0 ) THEN
447 *
448 * 1-by-1 pivot interchange
449 *
450 * Swap rows i and IPIV(i) in A(i:N,1:i-1)
451 *
452  ip = ipiv( i )
453  IF ( i.GT.1 ) THEN
454  IF( ip.NE.i ) THEN
455  CALL cswap( i-1, a( i, 1 ), lda,
456  $ a( ip, 1 ), lda )
457  END IF
458  END IF
459 *
460  ELSE
461 *
462 * 2-by-2 pivot interchange
463 *
464 * Swap rows i+1 and IPIV(i) in A(i:N,1:i-1)
465 *
466  ip = -ipiv( i )
467  IF ( i.GT.1 ) THEN
468  IF( ip.NE.(i+1) ) THEN
469  CALL cswap( i-1, a( i+1, 1 ), lda,
470  $ a( ip, 1 ), lda )
471  END IF
472  END IF
473 *
474 * Convert IPIV
475 * There is no interchnge of rows i and and IPIV(i),
476 * so this should be reflected in IPIV format for
477 * *SYTRF_RK ( or *SYTRF_BK)
478 *
479  ipiv( i ) = i
480 *
481  i = i + 1
482 *
483  END IF
484  i = i + 1
485  END DO
486 *
487  ELSE
488 *
489 * Revert A (A is lower)
490 *
491 *
492 * Revert PERMUTATIONS and IPIV
493 *
494 * Apply permutaions to submatrices of lower part of A
495 * in reverse factorization order where i decreases from N to 1
496 *
497  i = n
498  DO WHILE ( i.GE.1 )
499  IF( ipiv( i ).GT.0 ) THEN
500 *
501 * 1-by-1 pivot interchange
502 *
503 * Swap rows i and IPIV(i) in A(i:N,1:i-1)
504 *
505  ip = ipiv( i )
506  IF ( i.GT.1 ) THEN
507  IF( ip.NE.i ) THEN
508  CALL cswap( i-1, a( ip, 1 ), lda,
509  $ a( i, 1 ), lda )
510  END IF
511  END IF
512 *
513  ELSE
514 *
515 * 2-by-2 pivot interchange
516 *
517 * Swap rows i+1 and IPIV(i) in A(i:N,1:i-1)
518 *
519  i = i - 1
520  ip = -ipiv( i )
521  IF ( i.GT.1 ) THEN
522  IF( ip.NE.(i+1) ) THEN
523  CALL cswap( i-1, a( ip, 1 ), lda,
524  $ a( i+1, 1 ), lda )
525  END IF
526  END IF
527 *
528 * Convert IPIV
529 * There is one interchange of rows i+1 and IPIV(i+1),
530 * so this should be recorded in consecutive entries
531 * in IPIV format for *SYTRF
532 *
533  ipiv( i ) = ipiv( i+1 )
534 *
535  END IF
536  i = i - 1
537  END DO
538 *
539 * Revert VALUE
540 * Assign subdiagonal entries of D from array E to
541 * subgiagonal entries of A.
542 *
543  i = 1
544  DO WHILE ( i.LE.n-1 )
545  IF( ipiv( i ).LT.0 ) THEN
546  a( i + 1, i ) = e( i )
547  i = i + 1
548  END IF
549  i = i + 1
550  END DO
551 *
552  END IF
553 *
554 * End A is LOWER
555 *
556  END IF
557 
558  RETURN
559 *
560 * End of CSYCONVF
561 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55
subroutine cswap(N, CX, INCX, CY, INCY)
CSWAP
Definition: cswap.f:83
Here is the call graph for this function: