LAPACK 3.3.0

ztrttp.f

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