Annotation of rpl/lapack/lapack/zspr.f, revision 1.1
1.1 ! bertrand 1: SUBROUTINE ZSPR( UPLO, N, ALPHA, X, INCX, AP )
! 2: *
! 3: * -- LAPACK auxiliary routine (version 3.2) --
! 4: * -- LAPACK is a software package provided by Univ. of Tennessee, --
! 5: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
! 6: * November 2006
! 7: *
! 8: * .. Scalar Arguments ..
! 9: CHARACTER UPLO
! 10: INTEGER INCX, N
! 11: COMPLEX*16 ALPHA
! 12: * ..
! 13: * .. Array Arguments ..
! 14: COMPLEX*16 AP( * ), X( * )
! 15: * ..
! 16: *
! 17: * Purpose
! 18: * =======
! 19: *
! 20: * ZSPR performs the symmetric rank 1 operation
! 21: *
! 22: * A := alpha*x*conjg( x' ) + A,
! 23: *
! 24: * where alpha is a complex scalar, x is an n element vector and A is an
! 25: * n by n symmetric matrix, supplied in packed form.
! 26: *
! 27: * Arguments
! 28: * ==========
! 29: *
! 30: * UPLO (input) CHARACTER*1
! 31: * On entry, UPLO specifies whether the upper or lower
! 32: * triangular part of the matrix A is supplied in the packed
! 33: * array AP as follows:
! 34: *
! 35: * UPLO = 'U' or 'u' The upper triangular part of A is
! 36: * supplied in AP.
! 37: *
! 38: * UPLO = 'L' or 'l' The lower triangular part of A is
! 39: * supplied in AP.
! 40: *
! 41: * Unchanged on exit.
! 42: *
! 43: * N (input) INTEGER
! 44: * On entry, N specifies the order of the matrix A.
! 45: * N must be at least zero.
! 46: * Unchanged on exit.
! 47: *
! 48: * ALPHA (input) COMPLEX*16
! 49: * On entry, ALPHA specifies the scalar alpha.
! 50: * Unchanged on exit.
! 51: *
! 52: * X (input) COMPLEX*16 array, dimension at least
! 53: * ( 1 + ( N - 1 )*abs( INCX ) ).
! 54: * Before entry, the incremented array X must contain the N-
! 55: * element vector x.
! 56: * Unchanged on exit.
! 57: *
! 58: * INCX (input) INTEGER
! 59: * On entry, INCX specifies the increment for the elements of
! 60: * X. INCX must not be zero.
! 61: * Unchanged on exit.
! 62: *
! 63: * AP (input/output) COMPLEX*16 array, dimension at least
! 64: * ( ( N*( N + 1 ) )/2 ).
! 65: * Before entry, with UPLO = 'U' or 'u', the array AP must
! 66: * contain the upper triangular part of the symmetric matrix
! 67: * packed sequentially, column by column, so that AP( 1 )
! 68: * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
! 69: * and a( 2, 2 ) respectively, and so on. On exit, the array
! 70: * AP is overwritten by the upper triangular part of the
! 71: * updated matrix.
! 72: * Before entry, with UPLO = 'L' or 'l', the array AP must
! 73: * contain the lower triangular part of the symmetric matrix
! 74: * packed sequentially, column by column, so that AP( 1 )
! 75: * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
! 76: * and a( 3, 1 ) respectively, and so on. On exit, the array
! 77: * AP is overwritten by the lower triangular part of the
! 78: * updated matrix.
! 79: * Note that the imaginary parts of the diagonal elements need
! 80: * not be set, they are assumed to be zero, and on exit they
! 81: * are set to zero.
! 82: *
! 83: * =====================================================================
! 84: *
! 85: * .. Parameters ..
! 86: COMPLEX*16 ZERO
! 87: PARAMETER ( ZERO = ( 0.0D+0, 0.0D+0 ) )
! 88: * ..
! 89: * .. Local Scalars ..
! 90: INTEGER I, INFO, IX, J, JX, K, KK, KX
! 91: COMPLEX*16 TEMP
! 92: * ..
! 93: * .. External Functions ..
! 94: LOGICAL LSAME
! 95: EXTERNAL LSAME
! 96: * ..
! 97: * .. External Subroutines ..
! 98: EXTERNAL XERBLA
! 99: * ..
! 100: * .. Executable Statements ..
! 101: *
! 102: * Test the input parameters.
! 103: *
! 104: INFO = 0
! 105: IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
! 106: INFO = 1
! 107: ELSE IF( N.LT.0 ) THEN
! 108: INFO = 2
! 109: ELSE IF( INCX.EQ.0 ) THEN
! 110: INFO = 5
! 111: END IF
! 112: IF( INFO.NE.0 ) THEN
! 113: CALL XERBLA( 'ZSPR ', INFO )
! 114: RETURN
! 115: END IF
! 116: *
! 117: * Quick return if possible.
! 118: *
! 119: IF( ( N.EQ.0 ) .OR. ( ALPHA.EQ.ZERO ) )
! 120: $ RETURN
! 121: *
! 122: * Set the start point in X if the increment is not unity.
! 123: *
! 124: IF( INCX.LE.0 ) THEN
! 125: KX = 1 - ( N-1 )*INCX
! 126: ELSE IF( INCX.NE.1 ) THEN
! 127: KX = 1
! 128: END IF
! 129: *
! 130: * Start the operations. In this version the elements of the array AP
! 131: * are accessed sequentially with one pass through AP.
! 132: *
! 133: KK = 1
! 134: IF( LSAME( UPLO, 'U' ) ) THEN
! 135: *
! 136: * Form A when upper triangle is stored in AP.
! 137: *
! 138: IF( INCX.EQ.1 ) THEN
! 139: DO 20 J = 1, N
! 140: IF( X( J ).NE.ZERO ) THEN
! 141: TEMP = ALPHA*X( J )
! 142: K = KK
! 143: DO 10 I = 1, J - 1
! 144: AP( K ) = AP( K ) + X( I )*TEMP
! 145: K = K + 1
! 146: 10 CONTINUE
! 147: AP( KK+J-1 ) = AP( KK+J-1 ) + X( J )*TEMP
! 148: ELSE
! 149: AP( KK+J-1 ) = AP( KK+J-1 )
! 150: END IF
! 151: KK = KK + J
! 152: 20 CONTINUE
! 153: ELSE
! 154: JX = KX
! 155: DO 40 J = 1, N
! 156: IF( X( JX ).NE.ZERO ) THEN
! 157: TEMP = ALPHA*X( JX )
! 158: IX = KX
! 159: DO 30 K = KK, KK + J - 2
! 160: AP( K ) = AP( K ) + X( IX )*TEMP
! 161: IX = IX + INCX
! 162: 30 CONTINUE
! 163: AP( KK+J-1 ) = AP( KK+J-1 ) + X( JX )*TEMP
! 164: ELSE
! 165: AP( KK+J-1 ) = AP( KK+J-1 )
! 166: END IF
! 167: JX = JX + INCX
! 168: KK = KK + J
! 169: 40 CONTINUE
! 170: END IF
! 171: ELSE
! 172: *
! 173: * Form A when lower triangle is stored in AP.
! 174: *
! 175: IF( INCX.EQ.1 ) THEN
! 176: DO 60 J = 1, N
! 177: IF( X( J ).NE.ZERO ) THEN
! 178: TEMP = ALPHA*X( J )
! 179: AP( KK ) = AP( KK ) + TEMP*X( J )
! 180: K = KK + 1
! 181: DO 50 I = J + 1, N
! 182: AP( K ) = AP( K ) + X( I )*TEMP
! 183: K = K + 1
! 184: 50 CONTINUE
! 185: ELSE
! 186: AP( KK ) = AP( KK )
! 187: END IF
! 188: KK = KK + N - J + 1
! 189: 60 CONTINUE
! 190: ELSE
! 191: JX = KX
! 192: DO 80 J = 1, N
! 193: IF( X( JX ).NE.ZERO ) THEN
! 194: TEMP = ALPHA*X( JX )
! 195: AP( KK ) = AP( KK ) + TEMP*X( JX )
! 196: IX = JX
! 197: DO 70 K = KK + 1, KK + N - J
! 198: IX = IX + INCX
! 199: AP( K ) = AP( K ) + X( IX )*TEMP
! 200: 70 CONTINUE
! 201: ELSE
! 202: AP( KK ) = AP( KK )
! 203: END IF
! 204: JX = JX + INCX
! 205: KK = KK + N - J + 1
! 206: 80 CONTINUE
! 207: END IF
! 208: END IF
! 209: *
! 210: RETURN
! 211: *
! 212: * End of ZSPR
! 213: *
! 214: END
CVSweb interface <joel.bertrand@systella.fr>