LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine ztftri ( character  TRANSR,
character  UPLO,
character  DIAG,
integer  N,
complex*16, dimension( 0: * )  A,
integer  INFO 
)

ZTFTRI

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

Purpose:
 ZTFTRI computes the inverse of a triangular matrix A stored in RFP
 format.

 This is a Level 3 BLAS version of the algorithm.
Parameters
[in]TRANSR
          TRANSR is CHARACTER*1
          = 'N':  The Normal TRANSR of RFP A is stored;
          = 'C':  The Conjugate-transpose TRANSR of RFP A is stored.
[in]UPLO
          UPLO is CHARACTER*1
          = 'U':  A is upper triangular;
          = 'L':  A is lower triangular.
[in]DIAG
          DIAG is CHARACTER*1
          = 'N':  A is non-unit triangular;
          = 'U':  A is unit triangular.
[in]N
          N is INTEGER
          The order of the matrix A.  N >= 0.
[in,out]A
          A is COMPLEX*16 array, dimension ( N*(N+1)/2 );
          On entry, the triangular matrix A in RFP format. RFP format
          is described by TRANSR, UPLO, and N as follows: If TRANSR =
          'N' then RFP A is (0:N,0:k-1) when N is even; k=N/2. RFP A is
          (0:N-1,0:k) when N is odd; k=N/2. IF TRANSR = 'C' then RFP is
          the Conjugate-transpose of RFP A as defined when
          TRANSR = 'N'. The contents of RFP A are defined by UPLO as
          follows: If UPLO = 'U' the RFP A contains the nt elements of
          upper packed A; If UPLO = 'L' the RFP A contains the nt
          elements of lower packed A. The LDA of RFP A is (N+1)/2 when
          TRANSR = 'C'. When TRANSR is 'N' the LDA is N+1 when N is
          even and N is odd. See the Note below for more details.

          On exit, the (triangular) inverse of the original matrix, in
          the same storage format.
[out]INFO
          INFO is INTEGER
          = 0: successful exit
          < 0: if INFO = -i, the i-th argument had an illegal value
          > 0: if INFO = i, A(i,i) is exactly zero.  The triangular
               matrix is singular and its inverse can not be computed.
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  We first consider Standard Packed Format when N is even.
  We give an example where N = 6.

      AP is Upper             AP is Lower

   00 01 02 03 04 05       00
      11 12 13 14 15       10 11
         22 23 24 25       20 21 22
            33 34 35       30 31 32 33
               44 45       40 41 42 43 44
                  55       50 51 52 53 54 55


  Let TRANSR = 'N'. RFP holds AP as follows:
  For UPLO = 'U' the upper trapezoid A(0:5,0:2) consists of the last
  three columns of AP upper. The lower triangle A(4:6,0:2) consists of
  conjugate-transpose of the first three columns of AP upper.
  For UPLO = 'L' the lower trapezoid A(1:6,0:2) consists of the first
  three columns of AP lower. The upper triangle A(0:2,0:2) consists of
  conjugate-transpose of the last three columns of AP lower.
  To denote conjugate we place -- above the element. This covers the
  case N even and TRANSR = 'N'.

         RFP A                   RFP A

                                -- -- --
        03 04 05                33 43 53
                                   -- --
        13 14 15                00 44 54
                                      --
        23 24 25                10 11 55

        33 34 35                20 21 22
        --
        00 44 45                30 31 32
        -- --
        01 11 55                40 41 42
        -- -- --
        02 12 22                50 51 52

  Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
  transpose of RFP A above. One therefore gets:


           RFP A                   RFP A

     -- -- -- --                -- -- -- -- -- --
     03 13 23 33 00 01 02    33 00 10 20 30 40 50
     -- -- -- -- --                -- -- -- -- --
     04 14 24 34 44 11 12    43 44 11 21 31 41 51
     -- -- -- -- -- --                -- -- -- --
     05 15 25 35 45 55 22    53 54 55 22 32 42 52


  We next  consider Standard Packed Format when N is odd.
  We give an example where N = 5.

     AP is Upper                 AP is Lower

   00 01 02 03 04              00
      11 12 13 14              10 11
         22 23 24              20 21 22
            33 34              30 31 32 33
               44              40 41 42 43 44


  Let TRANSR = 'N'. RFP holds AP as follows:
  For UPLO = 'U' the upper trapezoid A(0:4,0:2) consists of the last
  three columns of AP upper. The lower triangle A(3:4,0:1) consists of
  conjugate-transpose of the first two   columns of AP upper.
  For UPLO = 'L' the lower trapezoid A(0:4,0:2) consists of the first
  three columns of AP lower. The upper triangle A(0:1,1:2) consists of
  conjugate-transpose of the last two   columns of AP lower.
  To denote conjugate we place -- above the element. This covers the
  case N odd  and TRANSR = 'N'.

         RFP A                   RFP A

                                   -- --
        02 03 04                00 33 43
                                      --
        12 13 14                10 11 44

        22 23 24                20 21 22
        --
        00 33 34                30 31 32
        -- --
        01 11 44                40 41 42

  Now let TRANSR = 'C'. RFP A in both UPLO cases is just the conjugate-
  transpose of RFP A above. One therefore gets:


           RFP A                   RFP A

     -- -- --                   -- -- -- -- -- --
     02 12 22 00 01             00 10 20 30 40 50
     -- -- -- --                   -- -- -- -- --
     03 13 23 33 11             33 11 21 31 41 51
     -- -- -- -- --                   -- -- -- --
     04 14 24 34 44             43 44 22 32 42 52

Definition at line 223 of file ztftri.f.

223 *
224 * -- LAPACK computational routine (version 3.4.0) --
225 * -- LAPACK is a software package provided by Univ. of Tennessee, --
226 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
227 * November 2011
228 *
229 * .. Scalar Arguments ..
230  CHARACTER transr, uplo, diag
231  INTEGER info, n
232 * ..
233 * .. Array Arguments ..
234  COMPLEX*16 a( 0: * )
235 * ..
236 *
237 * =====================================================================
238 *
239 * .. Parameters ..
240  COMPLEX*16 cone
241  parameter ( cone = ( 1.0d+0, 0.0d+0 ) )
242 * ..
243 * .. Local Scalars ..
244  LOGICAL lower, nisodd, normaltransr
245  INTEGER n1, n2, k
246 * ..
247 * .. External Functions ..
248  LOGICAL lsame
249  EXTERNAL lsame
250 * ..
251 * .. External Subroutines ..
252  EXTERNAL xerbla, ztrmm, ztrtri
253 * ..
254 * .. Intrinsic Functions ..
255  INTRINSIC mod
256 * ..
257 * .. Executable Statements ..
258 *
259 * Test the input parameters.
260 *
261  info = 0
262  normaltransr = lsame( transr, 'N' )
263  lower = lsame( uplo, 'L' )
264  IF( .NOT.normaltransr .AND. .NOT.lsame( transr, 'C' ) ) THEN
265  info = -1
266  ELSE IF( .NOT.lower .AND. .NOT.lsame( uplo, 'U' ) ) THEN
267  info = -2
268  ELSE IF( .NOT.lsame( diag, 'N' ) .AND. .NOT.lsame( diag, 'U' ) )
269  $ THEN
270  info = -3
271  ELSE IF( n.LT.0 ) THEN
272  info = -4
273  END IF
274  IF( info.NE.0 ) THEN
275  CALL xerbla( 'ZTFTRI', -info )
276  RETURN
277  END IF
278 *
279 * Quick return if possible
280 *
281  IF( n.EQ.0 )
282  $ RETURN
283 *
284 * If N is odd, set NISODD = .TRUE.
285 * If N is even, set K = N/2 and NISODD = .FALSE.
286 *
287  IF( mod( n, 2 ).EQ.0 ) THEN
288  k = n / 2
289  nisodd = .false.
290  ELSE
291  nisodd = .true.
292  END IF
293 *
294 * Set N1 and N2 depending on LOWER
295 *
296  IF( lower ) THEN
297  n2 = n / 2
298  n1 = n - n2
299  ELSE
300  n1 = n / 2
301  n2 = n - n1
302  END IF
303 *
304 *
305 * start execution: there are eight cases
306 *
307  IF( nisodd ) THEN
308 *
309 * N is odd
310 *
311  IF( normaltransr ) THEN
312 *
313 * N is odd and TRANSR = 'N'
314 *
315  IF( lower ) THEN
316 *
317 * SRPA for LOWER, NORMAL and N is odd ( a(0:n-1,0:n1-1) )
318 * T1 -> a(0,0), T2 -> a(0,1), S -> a(n1,0)
319 * T1 -> a(0), T2 -> a(n), S -> a(n1)
320 *
321  CALL ztrtri( 'L', diag, n1, a( 0 ), n, info )
322  IF( info.GT.0 )
323  $ RETURN
324  CALL ztrmm( 'R', 'L', 'N', diag, n2, n1, -cone, a( 0 ),
325  $ n, a( n1 ), n )
326  CALL ztrtri( 'U', diag, n2, a( n ), n, info )
327  IF( info.GT.0 )
328  $ info = info + n1
329  IF( info.GT.0 )
330  $ RETURN
331  CALL ztrmm( 'L', 'U', 'C', diag, n2, n1, cone, a( n ), n,
332  $ a( n1 ), n )
333 *
334  ELSE
335 *
336 * SRPA for UPPER, NORMAL and N is odd ( a(0:n-1,0:n2-1)
337 * T1 -> a(n1+1,0), T2 -> a(n1,0), S -> a(0,0)
338 * T1 -> a(n2), T2 -> a(n1), S -> a(0)
339 *
340  CALL ztrtri( 'L', diag, n1, a( n2 ), n, info )
341  IF( info.GT.0 )
342  $ RETURN
343  CALL ztrmm( 'L', 'L', 'C', diag, n1, n2, -cone, a( n2 ),
344  $ n, a( 0 ), n )
345  CALL ztrtri( 'U', diag, n2, a( n1 ), n, info )
346  IF( info.GT.0 )
347  $ info = info + n1
348  IF( info.GT.0 )
349  $ RETURN
350  CALL ztrmm( 'R', 'U', 'N', diag, n1, n2, cone, a( n1 ),
351  $ n, a( 0 ), n )
352 *
353  END IF
354 *
355  ELSE
356 *
357 * N is odd and TRANSR = 'C'
358 *
359  IF( lower ) THEN
360 *
361 * SRPA for LOWER, TRANSPOSE and N is odd
362 * T1 -> a(0), T2 -> a(1), S -> a(0+n1*n1)
363 *
364  CALL ztrtri( 'U', diag, n1, a( 0 ), n1, info )
365  IF( info.GT.0 )
366  $ RETURN
367  CALL ztrmm( 'L', 'U', 'N', diag, n1, n2, -cone, a( 0 ),
368  $ n1, a( n1*n1 ), n1 )
369  CALL ztrtri( 'L', diag, n2, a( 1 ), n1, info )
370  IF( info.GT.0 )
371  $ info = info + n1
372  IF( info.GT.0 )
373  $ RETURN
374  CALL ztrmm( 'R', 'L', 'C', diag, n1, n2, cone, a( 1 ),
375  $ n1, a( n1*n1 ), n1 )
376 *
377  ELSE
378 *
379 * SRPA for UPPER, TRANSPOSE and N is odd
380 * T1 -> a(0+n2*n2), T2 -> a(0+n1*n2), S -> a(0)
381 *
382  CALL ztrtri( 'U', diag, n1, a( n2*n2 ), n2, info )
383  IF( info.GT.0 )
384  $ RETURN
385  CALL ztrmm( 'R', 'U', 'C', diag, n2, n1, -cone,
386  $ a( n2*n2 ), n2, a( 0 ), n2 )
387  CALL ztrtri( 'L', diag, n2, a( n1*n2 ), n2, info )
388  IF( info.GT.0 )
389  $ info = info + n1
390  IF( info.GT.0 )
391  $ RETURN
392  CALL ztrmm( 'L', 'L', 'N', diag, n2, n1, cone,
393  $ a( n1*n2 ), n2, a( 0 ), n2 )
394  END IF
395 *
396  END IF
397 *
398  ELSE
399 *
400 * N is even
401 *
402  IF( normaltransr ) THEN
403 *
404 * N is even and TRANSR = 'N'
405 *
406  IF( lower ) THEN
407 *
408 * SRPA for LOWER, NORMAL, and N is even ( a(0:n,0:k-1) )
409 * T1 -> a(1,0), T2 -> a(0,0), S -> a(k+1,0)
410 * T1 -> a(1), T2 -> a(0), S -> a(k+1)
411 *
412  CALL ztrtri( 'L', diag, k, a( 1 ), n+1, info )
413  IF( info.GT.0 )
414  $ RETURN
415  CALL ztrmm( 'R', 'L', 'N', diag, k, k, -cone, a( 1 ),
416  $ n+1, a( k+1 ), n+1 )
417  CALL ztrtri( 'U', diag, k, a( 0 ), n+1, info )
418  IF( info.GT.0 )
419  $ info = info + k
420  IF( info.GT.0 )
421  $ RETURN
422  CALL ztrmm( 'L', 'U', 'C', diag, k, k, cone, a( 0 ), n+1,
423  $ a( k+1 ), n+1 )
424 *
425  ELSE
426 *
427 * SRPA for UPPER, NORMAL, and N is even ( a(0:n,0:k-1) )
428 * T1 -> a(k+1,0) , T2 -> a(k,0), S -> a(0,0)
429 * T1 -> a(k+1), T2 -> a(k), S -> a(0)
430 *
431  CALL ztrtri( 'L', diag, k, a( k+1 ), n+1, info )
432  IF( info.GT.0 )
433  $ RETURN
434  CALL ztrmm( 'L', 'L', 'C', diag, k, k, -cone, a( k+1 ),
435  $ n+1, a( 0 ), n+1 )
436  CALL ztrtri( 'U', diag, k, a( k ), n+1, info )
437  IF( info.GT.0 )
438  $ info = info + k
439  IF( info.GT.0 )
440  $ RETURN
441  CALL ztrmm( 'R', 'U', 'N', diag, k, k, cone, a( k ), n+1,
442  $ a( 0 ), n+1 )
443  END IF
444  ELSE
445 *
446 * N is even and TRANSR = 'C'
447 *
448  IF( lower ) THEN
449 *
450 * SRPA for LOWER, TRANSPOSE and N is even (see paper)
451 * T1 -> B(0,1), T2 -> B(0,0), S -> B(0,k+1)
452 * T1 -> a(0+k), T2 -> a(0+0), S -> a(0+k*(k+1)); lda=k
453 *
454  CALL ztrtri( 'U', diag, k, a( k ), k, info )
455  IF( info.GT.0 )
456  $ RETURN
457  CALL ztrmm( 'L', 'U', 'N', diag, k, k, -cone, a( k ), k,
458  $ a( k*( k+1 ) ), k )
459  CALL ztrtri( 'L', diag, k, a( 0 ), k, info )
460  IF( info.GT.0 )
461  $ info = info + k
462  IF( info.GT.0 )
463  $ RETURN
464  CALL ztrmm( 'R', 'L', 'C', diag, k, k, cone, a( 0 ), k,
465  $ a( k*( k+1 ) ), k )
466  ELSE
467 *
468 * SRPA for UPPER, TRANSPOSE and N is even (see paper)
469 * T1 -> B(0,k+1), T2 -> B(0,k), S -> B(0,0)
470 * T1 -> a(0+k*(k+1)), T2 -> a(0+k*k), S -> a(0+0)); lda=k
471 *
472  CALL ztrtri( 'U', diag, k, a( k*( k+1 ) ), k, info )
473  IF( info.GT.0 )
474  $ RETURN
475  CALL ztrmm( 'R', 'U', 'C', diag, k, k, -cone,
476  $ a( k*( k+1 ) ), k, a( 0 ), k )
477  CALL ztrtri( 'L', diag, k, a( k*k ), k, info )
478  IF( info.GT.0 )
479  $ info = info + k
480  IF( info.GT.0 )
481  $ RETURN
482  CALL ztrmm( 'L', 'L', 'N', diag, k, k, cone, a( k*k ), k,
483  $ a( 0 ), k )
484  END IF
485  END IF
486  END IF
487 *
488  RETURN
489 *
490 * End of ZTFTRI
491 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
subroutine ztrmm(SIDE, UPLO, TRANSA, DIAG, M, N, ALPHA, A, LDA, B, LDB)
ZTRMM
Definition: ztrmm.f:179
subroutine ztrtri(UPLO, DIAG, N, A, LDA, INFO)
ZTRTRI
Definition: ztrtri.f:111
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: