LAPACK 3.3.1 Linear Algebra PACKage

# ctpttr.f

Go to the documentation of this file.
```00001       SUBROUTINE CTPTTR( UPLO, N, AP, A, LDA, INFO )
00002 *
00003 *  -- LAPACK routine (version 3.3.0)                                    --
00004 *
00005 *  -- Contributed by Julien Langou of the Univ. of Colorado Denver    --
00006 *     November 2010                                                   --
00007 *
00008 *  -- LAPACK is a software package provided by Univ. of Tennessee,    --
00009 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00010 *
00011 *     .. Scalar Arguments ..
00012       CHARACTER          UPLO
00013       INTEGER            INFO, N, LDA
00014 *     ..
00015 *     .. Array Arguments ..
00016       COMPLEX            A( LDA, * ), AP( * )
00017 *     ..
00018 *
00019 *  Purpose
00020 *  =======
00021 *
00022 *  CTPTTR copies a triangular matrix A from standard packed format (TP)
00023 *  to standard full format (TR).
00024 *
00025 *  Arguments
00026 *  =========
00027 *
00028 *  UPLO    (input) CHARACTER*1
00029 *          = 'U':  A is upper triangular.
00030 *          = 'L':  A is lower triangular.
00031 *
00032 *  N       (input) INTEGER
00033 *          The order of the matrix A. N >= 0.
00034 *
00035 *  AP      (input) COMPLEX array, dimension ( N*(N+1)/2 ),
00036 *          On entry, the upper or lower triangular matrix A, packed
00037 *          columnwise in a linear array. The j-th column of A is stored
00038 *          in the array AP as follows:
00039 *          if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
00040 *          if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
00041 *
00042 *  A       (output) COMPLEX array, dimension ( LDA, N )
00043 *          On exit, the triangular matrix A.  If UPLO = 'U', the leading
00044 *          N-by-N upper triangular part of A contains the upper
00045 *          triangular part of the matrix A, and the strictly lower
00046 *          triangular part of A is not referenced.  If UPLO = 'L', the
00047 *          leading N-by-N lower triangular part of A contains the lower
00048 *          triangular part of the matrix A, and the strictly upper
00049 *          triangular part of A is not referenced.
00050 *
00051 *  LDA     (input) INTEGER
00052 *          The leading dimension of the array A.  LDA >= max(1,N).
00053 *
00054 *  INFO    (output) INTEGER
00055 *          = 0:  successful exit
00056 *          < 0:  if INFO = -i, the i-th argument had an illegal value
00057 *
00058 *  =====================================================================
00059 *
00060 *     .. Parameters ..
00061 *     ..
00062 *     .. Local Scalars ..
00063       LOGICAL            LOWER
00064       INTEGER            I, J, K
00065 *     ..
00066 *     .. External Functions ..
00067       LOGICAL            LSAME
00068       EXTERNAL           LSAME
00069 *     ..
00070 *     .. External Subroutines ..
00071       EXTERNAL           XERBLA
00072 *     ..
00073 *     .. Executable Statements ..
00074 *
00075 *     Test the input parameters.
00076 *
00077       INFO = 0
00078       LOWER = LSAME( UPLO, 'L' )
00079       IF( .NOT.LOWER .AND. .NOT.LSAME( UPLO, 'U' ) ) THEN
00080          INFO = -1
00081       ELSE IF( N.LT.0 ) THEN
00082          INFO = -2
00083       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
00084          INFO = -5
00085       END IF
00086       IF( INFO.NE.0 ) THEN
00087          CALL XERBLA( 'CTPTTR', -INFO )
00088          RETURN
00089       END IF
00090 *
00091       IF( LOWER ) THEN
00092          K = 0
00093          DO J = 1, N
00094             DO I = J, N
00095                K = K + 1
00096                A( I, J ) = AP( K )
00097             END DO
00098          END DO
00099       ELSE
00100          K = 0
00101          DO J = 1, N
00102             DO I = 1, J
00103                K = K + 1
00104                A( I, J ) = AP( K )
00105             END DO
00106          END DO
00107       END IF
00108 *
00109 *
00110       RETURN
00111 *
00112 *     End of CTPTTR
00113 *
00114       END
```