*> \brief \b CDOTC * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY) * * .. Scalar Arguments .. * INTEGER INCX,INCY,N * .. * .. Array Arguments .. * COMPLEX CX(*),CY(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CDOTC forms the dot product of two complex vectors *> CDOTC = X^H * Y *> *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> number of elements in input vector(s) *> \endverbatim *> *> \param[in] CX *> \verbatim *> CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> storage spacing between elements of CX *> \endverbatim *> *> \param[in] CY *> \verbatim *> CY is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCY ) ) *> \endverbatim *> *> \param[in] INCY *> \verbatim *> INCY is INTEGER *> storage spacing between elements of CY *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup dot * *> \par Further Details: * ===================== *> *> \verbatim *> *> jack dongarra, linpack, 3/11/78. *> modified 12/3/93, array(1) declarations changed to array(*) *> \endverbatim *> * ===================================================================== COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY) * * -- Reference BLAS level1 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. INTEGER INCX,INCY,N * .. * .. Array Arguments .. COMPLEX CX(*),CY(*) * .. * * ===================================================================== * * .. Local Scalars .. COMPLEX CTEMP INTEGER I,IX,IY * .. * .. Intrinsic Functions .. INTRINSIC CONJG * .. CTEMP = (0.0,0.0) CDOTC = (0.0,0.0) IF (N.LE.0) RETURN IF (INCX.EQ.1 .AND. INCY.EQ.1) THEN * * code for both increments equal to 1 * DO I = 1,N CTEMP = CTEMP + CONJG(CX(I))*CY(I) END DO ELSE * * code for unequal increments or equal increments * not equal to 1 * IX = 1 IY = 1 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 DO I = 1,N CTEMP = CTEMP + CONJG(CX(IX))*CY(IY) IX = IX + INCX IY = IY + INCY END DO END IF CDOTC = CTEMP RETURN * * End of CDOTC * END *> \brief \b CHPR * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE CHPR(UPLO,N,ALPHA,X,INCX,AP) * * .. Scalar Arguments .. * REAL ALPHA * INTEGER INCX,N * CHARACTER UPLO * .. * .. Array Arguments .. * COMPLEX AP(*),X(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CHPR performs the hermitian rank 1 operation *> *> A := alpha*x*x**H + A, *> *> where alpha is a real scalar, x is an n element vector and A is an *> n by n hermitian matrix, supplied in packed form. *> \endverbatim * * Arguments: * ========== * *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> On entry, UPLO specifies whether the upper or lower *> triangular part of the matrix A is supplied in the packed *> array AP as follows: *> *> UPLO = 'U' or 'u' The upper triangular part of A is *> supplied in AP. *> *> UPLO = 'L' or 'l' The lower triangular part of A is *> supplied in AP. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> On entry, N specifies the order of the matrix A. *> N must be at least zero. *> \endverbatim *> *> \param[in] ALPHA *> \verbatim *> ALPHA is REAL *> On entry, ALPHA specifies the scalar alpha. *> \endverbatim *> *> \param[in] X *> \verbatim *> X is COMPLEX array, dimension at least *> ( 1 + ( n - 1 )*abs( INCX ) ). *> Before entry, the incremented array X must contain the n *> element vector x. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> On entry, INCX specifies the increment for the elements of *> X. INCX must not be zero. *> \endverbatim *> *> \param[in,out] AP *> \verbatim *> AP is COMPLEX array, dimension at least *> ( ( n*( n + 1 ) )/2 ). *> Before entry with UPLO = 'U' or 'u', the array AP must *> contain the upper triangular part of the hermitian matrix *> packed sequentially, column by column, so that AP( 1 ) *> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) *> and a( 2, 2 ) respectively, and so on. On exit, the array *> AP is overwritten by the upper triangular part of the *> updated matrix. *> Before entry with UPLO = 'L' or 'l', the array AP must *> contain the lower triangular part of the hermitian matrix *> packed sequentially, column by column, so that AP( 1 ) *> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) *> and a( 3, 1 ) respectively, and so on. On exit, the array *> AP is overwritten by the lower triangular part of the *> updated matrix. *> Note that the imaginary parts of the diagonal elements need *> not be set, they are assumed to be zero, and on exit they *> are set to zero. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup hpr * *> \par Further Details: * ===================== *> *> \verbatim *> *> Level 2 Blas routine. *> *> -- Written on 22-October-1986. *> Jack Dongarra, Argonne National Lab. *> Jeremy Du Croz, Nag Central Office. *> Sven Hammarling, Nag Central Office. *> Richard Hanson, Sandia National Labs. *> \endverbatim *> * ===================================================================== SUBROUTINE CHPR(UPLO,N,ALPHA,X,INCX,AP) * * -- Reference BLAS level2 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. REAL ALPHA INTEGER INCX,N CHARACTER UPLO * .. * .. Array Arguments .. COMPLEX AP(*),X(*) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ZERO PARAMETER (ZERO= (0.0E+0,0.0E+0)) * .. * .. Local Scalars .. COMPLEX TEMP INTEGER I,INFO,IX,J,JX,K,KK,KX * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL XERBLA * .. * .. Intrinsic Functions .. INTRINSIC CONJG,REAL * .. * * Test the input parameters. * INFO = 0 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN INFO = 1 ELSE IF (N.LT.0) THEN INFO = 2 ELSE IF (INCX.EQ.0) THEN INFO = 5 END IF IF (INFO.NE.0) THEN CALL XERBLA('CHPR ',INFO) RETURN END IF * * Quick return if possible. * IF ((N.EQ.0) .OR. (ALPHA.EQ.REAL(ZERO))) RETURN * * Set the start point in X if the increment is not unity. * IF (INCX.LE.0) THEN KX = 1 - (N-1)*INCX ELSE IF (INCX.NE.1) THEN KX = 1 END IF * * Start the operations. In this version the elements of the array AP * are accessed sequentially with one pass through AP. * KK = 1 IF (LSAME(UPLO,'U')) THEN * * Form A when upper triangle is stored in AP. * IF (INCX.EQ.1) THEN DO 20 J = 1,N IF (X(J).NE.ZERO) THEN TEMP = ALPHA*CONJG(X(J)) K = KK DO 10 I = 1,J - 1 AP(K) = AP(K) + X(I)*TEMP K = K + 1 10 CONTINUE AP(KK+J-1) = REAL(AP(KK+J-1)) + REAL(X(J)*TEMP) ELSE AP(KK+J-1) = REAL(AP(KK+J-1)) END IF KK = KK + J 20 CONTINUE ELSE JX = KX DO 40 J = 1,N IF (X(JX).NE.ZERO) THEN TEMP = ALPHA*CONJG(X(JX)) IX = KX DO 30 K = KK,KK + J - 2 AP(K) = AP(K) + X(IX)*TEMP IX = IX + INCX 30 CONTINUE AP(KK+J-1) = REAL(AP(KK+J-1)) + REAL(X(JX)*TEMP) ELSE AP(KK+J-1) = REAL(AP(KK+J-1)) END IF JX = JX + INCX KK = KK + J 40 CONTINUE END IF ELSE * * Form A when lower triangle is stored in AP. * IF (INCX.EQ.1) THEN DO 60 J = 1,N IF (X(J).NE.ZERO) THEN TEMP = ALPHA*CONJG(X(J)) AP(KK) = REAL(AP(KK)) + REAL(TEMP*X(J)) K = KK + 1 DO 50 I = J + 1,N AP(K) = AP(K) + X(I)*TEMP K = K + 1 50 CONTINUE ELSE AP(KK) = REAL(AP(KK)) END IF KK = KK + N - J + 1 60 CONTINUE ELSE JX = KX DO 80 J = 1,N IF (X(JX).NE.ZERO) THEN TEMP = ALPHA*CONJG(X(JX)) AP(KK) = REAL(AP(KK)) + REAL(TEMP*X(JX)) IX = JX DO 70 K = KK + 1,KK + N - J IX = IX + INCX AP(K) = AP(K) + X(IX)*TEMP 70 CONTINUE ELSE AP(KK) = REAL(AP(KK)) END IF JX = JX + INCX KK = KK + N - J + 1 80 CONTINUE END IF END IF * RETURN * * End of CHPR * END *> \brief \b CPPTRI * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CPPTRI + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CPPTRI( UPLO, N, AP, INFO ) * * .. Scalar Arguments .. * CHARACTER UPLO * INTEGER INFO, N * .. * .. Array Arguments .. * COMPLEX AP( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CPPTRI computes the inverse of a complex Hermitian positive definite *> matrix A using the Cholesky factorization A = U**H*U or A = L*L**H *> computed by CPPTRF. *> \endverbatim * * Arguments: * ========== * *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> = 'U': Upper triangular factor is stored in AP; *> = 'L': Lower triangular factor is stored in AP. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the matrix A. N >= 0. *> \endverbatim *> *> \param[in,out] AP *> \verbatim *> AP is COMPLEX array, dimension (N*(N+1)/2) *> On entry, the triangular factor U or L from the Cholesky *> factorization A = U**H*U or A = L*L**H, packed columnwise as *> a linear array. The j-th column of U or L is stored in the *> array AP as follows: *> if UPLO = 'U', AP(i + (j-1)*j/2) = U(i,j) for 1<=i<=j; *> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = L(i,j) for j<=i<=n. *> *> On exit, the upper or lower triangle of the (Hermitian) *> inverse of A, overwriting the input factor U or L. *> \endverbatim *> *> \param[out] INFO *> \verbatim *> INFO is INTEGER *> = 0: successful exit *> < 0: if INFO = -i, the i-th argument had an illegal value *> > 0: if INFO = i, the (i,i) element of the factor U or L is *> zero, and the inverse could not be computed. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup pptri * * ===================================================================== SUBROUTINE CPPTRI( UPLO, N, AP, INFO ) * * -- LAPACK computational routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. CHARACTER UPLO INTEGER INFO, N * .. * .. Array Arguments .. COMPLEX AP( * ) * .. * * ===================================================================== * * .. Parameters .. REAL ONE PARAMETER ( ONE = 1.0E+0 ) * .. * .. Local Scalars .. LOGICAL UPPER INTEGER J, JC, JJ, JJN REAL AJJ * .. * .. External Functions .. LOGICAL LSAME COMPLEX CDOTC EXTERNAL LSAME, CDOTC * .. * .. External Subroutines .. EXTERNAL CHPR, CSSCAL, CTPMV, CTPTRI, XERBLA * .. * .. Intrinsic Functions .. INTRINSIC REAL * .. * .. Executable Statements .. * * Test the input parameters. * INFO = 0 UPPER = LSAME( UPLO, 'U' ) IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN INFO = -1 ELSE IF( N.LT.0 ) THEN INFO = -2 END IF IF( INFO.NE.0 ) THEN CALL XERBLA( 'CPPTRI', -INFO ) RETURN END IF * * Quick return if possible * IF( N.EQ.0 ) $ RETURN * * Invert the triangular Cholesky factor U or L. * CALL CTPTRI( UPLO, 'Non-unit', N, AP, INFO ) IF( INFO.GT.0 ) $ RETURN IF( UPPER ) THEN * * Compute the product inv(U) * inv(U)**H. * JJ = 0 DO 10 J = 1, N JC = JJ + 1 JJ = JJ + J IF( J.GT.1 ) $ CALL CHPR( 'Upper', J-1, ONE, AP( JC ), 1, AP ) AJJ = REAL( AP( JJ ) ) CALL CSSCAL( J, AJJ, AP( JC ), 1 ) 10 CONTINUE * ELSE * * Compute the product inv(L)**H * inv(L). * JJ = 1 DO 20 J = 1, N JJN = JJ + N - J + 1 AP( JJ ) = REAL( CDOTC( N-J+1, AP( JJ ), 1, AP( JJ ), $ 1 ) ) IF( J.LT.N ) $ CALL CTPMV( 'Lower', 'Conjugate transpose', $ 'Non-unit', $ N-J, AP( JJN ), AP( JJ+1 ), 1 ) JJ = JJN 20 CONTINUE END IF * RETURN * * End of CPPTRI * END *> \brief \b CSCAL * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE CSCAL(N,CA,CX,INCX) * * .. Scalar Arguments .. * COMPLEX CA * INTEGER INCX,N * .. * .. Array Arguments .. * COMPLEX CX(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CSCAL scales a vector by a constant. *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> number of elements in input vector(s) *> \endverbatim *> *> \param[in] CA *> \verbatim *> CA is COMPLEX *> On entry, CA specifies the scalar alpha. *> \endverbatim *> *> \param[in,out] CX *> \verbatim *> CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> storage spacing between elements of CX *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup scal * *> \par Further Details: * ===================== *> *> \verbatim *> *> jack dongarra, linpack, 3/11/78. *> modified 3/93 to return if incx .le. 0. *> modified 12/3/93, array(1) declarations changed to array(*) *> \endverbatim *> * ===================================================================== SUBROUTINE CSCAL(N,CA,CX,INCX) * * -- Reference BLAS level1 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. COMPLEX CA INTEGER INCX,N * .. * .. Array Arguments .. COMPLEX CX(*) * .. * * ===================================================================== * * .. Local Scalars .. INTEGER I,NINCX * .. * .. Parameters .. COMPLEX ONE PARAMETER (ONE= (1.0E+0,0.0E+0)) * .. IF (N.LE.0 .OR. INCX.LE.0 .OR. CA.EQ.ONE) RETURN IF (INCX.EQ.1) THEN * * code for increment equal to 1 * DO I = 1,N CX(I) = CA*CX(I) END DO ELSE * * code for increment not equal to 1 * NINCX = N*INCX DO I = 1,NINCX,INCX CX(I) = CA*CX(I) END DO END IF RETURN * * End of CSCAL * END *> \brief \b CSSCAL * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE CSSCAL(N,SA,CX,INCX) * * .. Scalar Arguments .. * REAL SA * INTEGER INCX,N * .. * .. Array Arguments .. * COMPLEX CX(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CSSCAL scales a complex vector by a real constant. *> \endverbatim * * Arguments: * ========== * *> \param[in] N *> \verbatim *> N is INTEGER *> number of elements in input vector(s) *> \endverbatim *> *> \param[in] SA *> \verbatim *> SA is REAL *> On entry, SA specifies the scalar alpha. *> \endverbatim *> *> \param[in,out] CX *> \verbatim *> CX is COMPLEX array, dimension ( 1 + ( N - 1 )*abs( INCX ) ) *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> storage spacing between elements of CX *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup scal * *> \par Further Details: * ===================== *> *> \verbatim *> *> jack dongarra, linpack, 3/11/78. *> modified 3/93 to return if incx .le. 0. *> modified 12/3/93, array(1) declarations changed to array(*) *> \endverbatim *> * ===================================================================== SUBROUTINE CSSCAL(N,SA,CX,INCX) * * -- Reference BLAS level1 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. REAL SA INTEGER INCX,N * .. * .. Array Arguments .. COMPLEX CX(*) * .. * * ===================================================================== * * .. Local Scalars .. INTEGER I,NINCX * .. * .. Parameters .. REAL ONE PARAMETER (ONE=1.0E+0) * .. * .. Intrinsic Functions .. INTRINSIC AIMAG,CMPLX,REAL * .. IF (N.LE.0 .OR. INCX.LE.0 .OR. SA.EQ.ONE) RETURN IF (INCX.EQ.1) THEN * * code for increment equal to 1 * DO I = 1,N CX(I) = CMPLX(SA*REAL(CX(I)),SA*AIMAG(CX(I))) END DO ELSE * * code for increment not equal to 1 * NINCX = N*INCX DO I = 1,NINCX,INCX CX(I) = CMPLX(SA*REAL(CX(I)),SA*AIMAG(CX(I))) END DO END IF RETURN * * End of CSSCAL * END *> \brief \b CTPMV * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE CTPMV(UPLO,TRANS,DIAG,N,AP,X,INCX) * * .. Scalar Arguments .. * INTEGER INCX,N * CHARACTER DIAG,TRANS,UPLO * .. * .. Array Arguments .. * COMPLEX AP(*),X(*) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CTPMV performs one of the matrix-vector operations *> *> x := A*x, or x := A**T*x, or x := A**H*x, *> *> where x is an n element vector and A is an n by n unit, or non-unit, *> upper or lower triangular matrix, supplied in packed form. *> \endverbatim * * Arguments: * ========== * *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> On entry, UPLO specifies whether the matrix is an upper or *> lower triangular matrix as follows: *> *> UPLO = 'U' or 'u' A is an upper triangular matrix. *> *> UPLO = 'L' or 'l' A is a lower triangular matrix. *> \endverbatim *> *> \param[in] TRANS *> \verbatim *> TRANS is CHARACTER*1 *> On entry, TRANS specifies the operation to be performed as *> follows: *> *> TRANS = 'N' or 'n' x := A*x. *> *> TRANS = 'T' or 't' x := A**T*x. *> *> TRANS = 'C' or 'c' x := A**H*x. *> \endverbatim *> *> \param[in] DIAG *> \verbatim *> DIAG is CHARACTER*1 *> On entry, DIAG specifies whether or not A is unit *> triangular as follows: *> *> DIAG = 'U' or 'u' A is assumed to be unit triangular. *> *> DIAG = 'N' or 'n' A is not assumed to be unit *> triangular. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> On entry, N specifies the order of the matrix A. *> N must be at least zero. *> \endverbatim *> *> \param[in] AP *> \verbatim *> AP is COMPLEX array, dimension at least *> ( ( n*( n + 1 ) )/2 ). *> Before entry with UPLO = 'U' or 'u', the array AP must *> contain the upper triangular matrix packed sequentially, *> column by column, so that AP( 1 ) contains a( 1, 1 ), *> AP( 2 ) and AP( 3 ) contain a( 1, 2 ) and a( 2, 2 ) *> respectively, and so on. *> Before entry with UPLO = 'L' or 'l', the array AP must *> contain the lower triangular matrix packed sequentially, *> column by column, so that AP( 1 ) contains a( 1, 1 ), *> AP( 2 ) and AP( 3 ) contain a( 2, 1 ) and a( 3, 1 ) *> respectively, and so on. *> Note that when DIAG = 'U' or 'u', the diagonal elements of *> A are not referenced, but are assumed to be unity. *> \endverbatim *> *> \param[in,out] X *> \verbatim *> X is COMPLEX array, dimension at least *> ( 1 + ( n - 1 )*abs( INCX ) ). *> Before entry, the incremented array X must contain the n *> element vector x. On exit, X is overwritten with the *> transformed vector x. *> \endverbatim *> *> \param[in] INCX *> \verbatim *> INCX is INTEGER *> On entry, INCX specifies the increment for the elements of *> X. INCX must not be zero. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup tpmv * *> \par Further Details: * ===================== *> *> \verbatim *> *> Level 2 Blas routine. *> The vector and matrix arguments are not referenced when N = 0, or M = 0 *> *> -- Written on 22-October-1986. *> Jack Dongarra, Argonne National Lab. *> Jeremy Du Croz, Nag Central Office. *> Sven Hammarling, Nag Central Office. *> Richard Hanson, Sandia National Labs. *> \endverbatim *> * ===================================================================== SUBROUTINE CTPMV(UPLO,TRANS,DIAG,N,AP,X,INCX) * * -- Reference BLAS level2 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. INTEGER INCX,N CHARACTER DIAG,TRANS,UPLO * .. * .. Array Arguments .. COMPLEX AP(*),X(*) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ZERO PARAMETER (ZERO= (0.0E+0,0.0E+0)) * .. * .. Local Scalars .. COMPLEX TEMP INTEGER I,INFO,IX,J,JX,K,KK,KX LOGICAL NOCONJ,NOUNIT * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL XERBLA * .. * .. Intrinsic Functions .. INTRINSIC CONJG * .. * * Test the input parameters. * INFO = 0 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN INFO = 1 ELSE IF (.NOT.LSAME(TRANS,'N') .AND. + .NOT.LSAME(TRANS,'T') .AND. + .NOT.LSAME(TRANS,'C')) THEN INFO = 2 ELSE IF (.NOT.LSAME(DIAG,'U') .AND. + .NOT.LSAME(DIAG,'N')) THEN INFO = 3 ELSE IF (N.LT.0) THEN INFO = 4 ELSE IF (INCX.EQ.0) THEN INFO = 7 END IF IF (INFO.NE.0) THEN CALL XERBLA('CTPMV ',INFO) RETURN END IF * * Quick return if possible. * IF (N.EQ.0) RETURN * NOCONJ = LSAME(TRANS,'T') NOUNIT = LSAME(DIAG,'N') * * Set up the start point in X if the increment is not unity. This * will be ( N - 1 )*INCX too small for descending loops. * IF (INCX.LE.0) THEN KX = 1 - (N-1)*INCX ELSE IF (INCX.NE.1) THEN KX = 1 END IF * * Start the operations. In this version the elements of AP are * accessed sequentially with one pass through AP. * IF (LSAME(TRANS,'N')) THEN * * Form x:= A*x. * IF (LSAME(UPLO,'U')) THEN KK = 1 IF (INCX.EQ.1) THEN DO 20 J = 1,N IF (X(J).NE.ZERO) THEN TEMP = X(J) K = KK DO 10 I = 1,J - 1 X(I) = X(I) + TEMP*AP(K) K = K + 1 10 CONTINUE IF (NOUNIT) X(J) = X(J)*AP(KK+J-1) END IF KK = KK + J 20 CONTINUE ELSE JX = KX DO 40 J = 1,N IF (X(JX).NE.ZERO) THEN TEMP = X(JX) IX = KX DO 30 K = KK,KK + J - 2 X(IX) = X(IX) + TEMP*AP(K) IX = IX + INCX 30 CONTINUE IF (NOUNIT) X(JX) = X(JX)*AP(KK+J-1) END IF JX = JX + INCX KK = KK + J 40 CONTINUE END IF ELSE KK = (N* (N+1))/2 IF (INCX.EQ.1) THEN DO 60 J = N,1,-1 IF (X(J).NE.ZERO) THEN TEMP = X(J) K = KK DO 50 I = N,J + 1,-1 X(I) = X(I) + TEMP*AP(K) K = K - 1 50 CONTINUE IF (NOUNIT) X(J) = X(J)*AP(KK-N+J) END IF KK = KK - (N-J+1) 60 CONTINUE ELSE KX = KX + (N-1)*INCX JX = KX DO 80 J = N,1,-1 IF (X(JX).NE.ZERO) THEN TEMP = X(JX) IX = KX DO 70 K = KK,KK - (N- (J+1)),-1 X(IX) = X(IX) + TEMP*AP(K) IX = IX - INCX 70 CONTINUE IF (NOUNIT) X(JX) = X(JX)*AP(KK-N+J) END IF JX = JX - INCX KK = KK - (N-J+1) 80 CONTINUE END IF END IF ELSE * * Form x := A**T*x or x := A**H*x. * IF (LSAME(UPLO,'U')) THEN KK = (N* (N+1))/2 IF (INCX.EQ.1) THEN DO 110 J = N,1,-1 TEMP = X(J) K = KK - 1 IF (NOCONJ) THEN IF (NOUNIT) TEMP = TEMP*AP(KK) DO 90 I = J - 1,1,-1 TEMP = TEMP + AP(K)*X(I) K = K - 1 90 CONTINUE ELSE IF (NOUNIT) TEMP = TEMP*CONJG(AP(KK)) DO 100 I = J - 1,1,-1 TEMP = TEMP + CONJG(AP(K))*X(I) K = K - 1 100 CONTINUE END IF X(J) = TEMP KK = KK - J 110 CONTINUE ELSE JX = KX + (N-1)*INCX DO 140 J = N,1,-1 TEMP = X(JX) IX = JX IF (NOCONJ) THEN IF (NOUNIT) TEMP = TEMP*AP(KK) DO 120 K = KK - 1,KK - J + 1,-1 IX = IX - INCX TEMP = TEMP + AP(K)*X(IX) 120 CONTINUE ELSE IF (NOUNIT) TEMP = TEMP*CONJG(AP(KK)) DO 130 K = KK - 1,KK - J + 1,-1 IX = IX - INCX TEMP = TEMP + CONJG(AP(K))*X(IX) 130 CONTINUE END IF X(JX) = TEMP JX = JX - INCX KK = KK - J 140 CONTINUE END IF ELSE KK = 1 IF (INCX.EQ.1) THEN DO 170 J = 1,N TEMP = X(J) K = KK + 1 IF (NOCONJ) THEN IF (NOUNIT) TEMP = TEMP*AP(KK) DO 150 I = J + 1,N TEMP = TEMP + AP(K)*X(I) K = K + 1 150 CONTINUE ELSE IF (NOUNIT) TEMP = TEMP*CONJG(AP(KK)) DO 160 I = J + 1,N TEMP = TEMP + CONJG(AP(K))*X(I) K = K + 1 160 CONTINUE END IF X(J) = TEMP KK = KK + (N-J+1) 170 CONTINUE ELSE JX = KX DO 200 J = 1,N TEMP = X(JX) IX = JX IF (NOCONJ) THEN IF (NOUNIT) TEMP = TEMP*AP(KK) DO 180 K = KK + 1,KK + N - J IX = IX + INCX TEMP = TEMP + AP(K)*X(IX) 180 CONTINUE ELSE IF (NOUNIT) TEMP = TEMP*CONJG(AP(KK)) DO 190 K = KK + 1,KK + N - J IX = IX + INCX TEMP = TEMP + CONJG(AP(K))*X(IX) 190 CONTINUE END IF X(JX) = TEMP JX = JX + INCX KK = KK + (N-J+1) 200 CONTINUE END IF END IF END IF * RETURN * * End of CTPMV * END *> \brief \b CTPTRI * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * *> \htmlonly *> Download CTPTRI + dependencies *> *> [TGZ] *> *> [ZIP] *> *> [TXT] *> \endhtmlonly * * Definition: * =========== * * SUBROUTINE CTPTRI( UPLO, DIAG, N, AP, INFO ) * * .. Scalar Arguments .. * CHARACTER DIAG, UPLO * INTEGER INFO, N * .. * .. Array Arguments .. * COMPLEX AP( * ) * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> CTPTRI computes the inverse of a complex upper or lower triangular *> matrix A stored in packed format. *> \endverbatim * * Arguments: * ========== * *> \param[in] UPLO *> \verbatim *> UPLO is CHARACTER*1 *> = 'U': A is upper triangular; *> = 'L': A is lower triangular. *> \endverbatim *> *> \param[in] DIAG *> \verbatim *> DIAG is CHARACTER*1 *> = 'N': A is non-unit triangular; *> = 'U': A is unit triangular. *> \endverbatim *> *> \param[in] N *> \verbatim *> N is INTEGER *> The order of the matrix A. N >= 0. *> \endverbatim *> *> \param[in,out] AP *> \verbatim *> AP is COMPLEX array, dimension (N*(N+1)/2) *> On entry, the upper or lower triangular matrix A, stored *> columnwise in a linear array. The j-th column of A is stored *> in the array AP as follows: *> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j; *> if UPLO = 'L', AP(i + (j-1)*((2*n-j)/2) = A(i,j) for j<=i<=n. *> See below for further details. *> On exit, the (triangular) inverse of the original matrix, in *> the same packed storage format. *> \endverbatim *> *> \param[out] INFO *> \verbatim *> 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. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup tptri * *> \par Further Details: * ===================== *> *> \verbatim *> *> A triangular matrix A can be transferred to packed storage using one *> of the following program segments: *> *> UPLO = 'U': UPLO = 'L': *> *> JC = 1 JC = 1 *> DO 2 J = 1, N DO 2 J = 1, N *> DO 1 I = 1, J DO 1 I = J, N *> AP(JC+I-1) = A(I,J) AP(JC+I-J) = A(I,J) *> 1 CONTINUE 1 CONTINUE *> JC = JC + J JC = JC + N - J + 1 *> 2 CONTINUE 2 CONTINUE *> \endverbatim *> * ===================================================================== SUBROUTINE CTPTRI( UPLO, DIAG, N, AP, INFO ) * * -- LAPACK computational routine -- * -- LAPACK is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. CHARACTER DIAG, UPLO INTEGER INFO, N * .. * .. Array Arguments .. COMPLEX AP( * ) * .. * * ===================================================================== * * .. Parameters .. COMPLEX ONE, ZERO PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ), $ ZERO = ( 0.0E+0, 0.0E+0 ) ) * .. * .. Local Scalars .. LOGICAL NOUNIT, UPPER INTEGER J, JC, JCLAST, JJ COMPLEX AJJ * .. * .. External Functions .. LOGICAL LSAME EXTERNAL LSAME * .. * .. External Subroutines .. EXTERNAL CSCAL, CTPMV, XERBLA * .. * .. Executable Statements .. * * Test the input parameters. * INFO = 0 UPPER = LSAME( UPLO, 'U' ) NOUNIT = LSAME( DIAG, 'N' ) IF( .NOT.UPPER .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN INFO = -1 ELSE IF( .NOT.NOUNIT .AND. .NOT.LSAME( DIAG, 'U' ) ) THEN INFO = -2 ELSE IF( N.LT.0 ) THEN INFO = -3 END IF IF( INFO.NE.0 ) THEN CALL XERBLA( 'CTPTRI', -INFO ) RETURN END IF * * Check for singularity if non-unit. * IF( NOUNIT ) THEN IF( UPPER ) THEN JJ = 0 DO 10 INFO = 1, N JJ = JJ + INFO IF( AP( JJ ).EQ.ZERO ) $ RETURN 10 CONTINUE ELSE JJ = 1 DO 20 INFO = 1, N IF( AP( JJ ).EQ.ZERO ) $ RETURN JJ = JJ + N - INFO + 1 20 CONTINUE END IF INFO = 0 END IF * IF( UPPER ) THEN * * Compute inverse of upper triangular matrix. * JC = 1 DO 30 J = 1, N IF( NOUNIT ) THEN AP( JC+J-1 ) = ONE / AP( JC+J-1 ) AJJ = -AP( JC+J-1 ) ELSE AJJ = -ONE END IF * * Compute elements 1:j-1 of j-th column. * CALL CTPMV( 'Upper', 'No transpose', DIAG, J-1, AP, $ AP( JC ), 1 ) CALL CSCAL( J-1, AJJ, AP( JC ), 1 ) JC = JC + J 30 CONTINUE * ELSE * * Compute inverse of lower triangular matrix. * JC = N*( N+1 ) / 2 DO 40 J = N, 1, -1 IF( NOUNIT ) THEN AP( JC ) = ONE / AP( JC ) AJJ = -AP( JC ) ELSE AJJ = -ONE END IF IF( J.LT.N ) THEN * * Compute elements j+1:n of j-th column. * CALL CTPMV( 'Lower', 'No transpose', DIAG, N-J, $ AP( JCLAST ), AP( JC+1 ), 1 ) CALL CSCAL( N-J, AJJ, AP( JC+1 ), 1 ) END IF JCLAST = JC JC = JC - N + J - 2 40 CONTINUE END IF * RETURN * * End of CTPTRI * END *> \brief \b LSAME * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * LOGICAL FUNCTION LSAME(CA,CB) * * .. Scalar Arguments .. * CHARACTER CA,CB * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> LSAME returns .TRUE. if CA is the same letter as CB regardless of *> case. *> \endverbatim * * Arguments: * ========== * *> \param[in] CA *> \verbatim *> CA is CHARACTER*1 *> \endverbatim *> *> \param[in] CB *> \verbatim *> CB is CHARACTER*1 *> CA and CB specify the single characters to be compared. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup lsame * * ===================================================================== LOGICAL FUNCTION LSAME(CA,CB) * * -- Reference BLAS level1 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. CHARACTER CA,CB * .. * * ===================================================================== * * .. Intrinsic Functions .. INTRINSIC ICHAR * .. * .. Local Scalars .. INTEGER INTA,INTB,ZCODE * .. * * Test if the characters are equal * LSAME = CA .EQ. CB IF (LSAME) RETURN * * Now test for equivalence if both characters are alphabetic. * ZCODE = ICHAR('Z') * * Use 'Z' rather than 'A' so that ASCII can be detected on Prime * machines, on which ICHAR returns a value with bit 8 set. * ICHAR('A') on Prime machines returns 193 which is the same as * ICHAR('A') on an EBCDIC machine. * INTA = ICHAR(CA) INTB = ICHAR(CB) * IF (ZCODE.EQ.90 .OR. ZCODE.EQ.122) THEN * * ASCII is assumed - ZCODE is the ASCII code of either lower or * upper case 'Z'. * IF (INTA.GE.97 .AND. INTA.LE.122) INTA = INTA - 32 IF (INTB.GE.97 .AND. INTB.LE.122) INTB = INTB - 32 * ELSE IF (ZCODE.EQ.233 .OR. ZCODE.EQ.169) THEN * * EBCDIC is assumed - ZCODE is the EBCDIC code of either lower or * upper case 'Z'. * IF (INTA.GE.129 .AND. INTA.LE.137 .OR. + INTA.GE.145 .AND. INTA.LE.153 .OR. + INTA.GE.162 .AND. INTA.LE.169) INTA = INTA + 64 IF (INTB.GE.129 .AND. INTB.LE.137 .OR. + INTB.GE.145 .AND. INTB.LE.153 .OR. + INTB.GE.162 .AND. INTB.LE.169) INTB = INTB + 64 * ELSE IF (ZCODE.EQ.218 .OR. ZCODE.EQ.250) THEN * * ASCII is assumed, on Prime machines - ZCODE is the ASCII code * plus 128 of either lower or upper case 'Z'. * IF (INTA.GE.225 .AND. INTA.LE.250) INTA = INTA - 32 IF (INTB.GE.225 .AND. INTB.LE.250) INTB = INTB - 32 END IF LSAME = INTA .EQ. INTB * * RETURN * * End of LSAME * END *> \brief \b XERBLA * * =========== DOCUMENTATION =========== * * Online html documentation available at * http://www.netlib.org/lapack/explore-html/ * * Definition: * =========== * * SUBROUTINE XERBLA( SRNAME, INFO ) * * .. Scalar Arguments .. * CHARACTER*(*) SRNAME * INTEGER INFO * .. * * *> \par Purpose: * ============= *> *> \verbatim *> *> XERBLA is an error handler for the LAPACK routines. *> It is called by an LAPACK routine if an input parameter has an *> invalid value. A message is printed and execution stops. *> *> Installers may consider modifying the STOP statement in order to *> call system-specific exception-handling facilities. *> \endverbatim * * Arguments: * ========== * *> \param[in] SRNAME *> \verbatim *> SRNAME is CHARACTER*(*) *> The name of the routine which called XERBLA. *> \endverbatim *> *> \param[in] INFO *> \verbatim *> INFO is INTEGER *> The position of the invalid parameter in the parameter list *> of the calling routine. *> \endverbatim * * Authors: * ======== * *> \author Univ. of Tennessee *> \author Univ. of California Berkeley *> \author Univ. of Colorado Denver *> \author NAG Ltd. * *> \ingroup xerbla * * ===================================================================== SUBROUTINE XERBLA( SRNAME, INFO ) * * -- Reference BLAS level1 routine -- * -- Reference BLAS is a software package provided by Univ. of Tennessee, -- * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- * * .. Scalar Arguments .. CHARACTER*(*) SRNAME INTEGER INFO * .. * * ===================================================================== * * .. Intrinsic Functions .. INTRINSIC LEN_TRIM * .. * .. Executable Statements .. * WRITE( *, FMT = 9999 )SRNAME( 1:LEN_TRIM( SRNAME ) ), INFO * STOP * 9999 FORMAT( ' ** On entry to ', A, ' parameter number ', I2, ' had ', $ 'an illegal value' ) * * End of XERBLA * END