Annotation of rpl/lapack/lapack/zsymv.f, revision 1.4

1.1       bertrand    1:       SUBROUTINE ZSYMV( UPLO, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY )
                      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, INCY, LDA, N
                     11:       COMPLEX*16         ALPHA, BETA
                     12: *     ..
                     13: *     .. Array Arguments ..
                     14:       COMPLEX*16         A( LDA, * ), X( * ), Y( * )
                     15: *     ..
                     16: *
                     17: *  Purpose
                     18: *  =======
                     19: *
                     20: *  ZSYMV  performs the matrix-vector  operation
                     21: *
                     22: *     y := alpha*A*x + beta*y,
                     23: *
                     24: *  where alpha and beta are scalars, x and y are n element vectors and
                     25: *  A is an n by n symmetric matrix.
                     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 array A is to be referenced as
                     33: *           follows:
                     34: *
                     35: *              UPLO = 'U' or 'u'   Only the upper triangular part of A
                     36: *                                  is to be referenced.
                     37: *
                     38: *              UPLO = 'L' or 'l'   Only the lower triangular part of A
                     39: *                                  is to be referenced.
                     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: *  A        (input) COMPLEX*16 array, dimension ( LDA, N )
                     53: *           Before entry, with  UPLO = 'U' or 'u', the leading n by n
                     54: *           upper triangular part of the array A must contain the upper
                     55: *           triangular part of the symmetric matrix and the strictly
                     56: *           lower triangular part of A is not referenced.
                     57: *           Before entry, with UPLO = 'L' or 'l', the leading n by n
                     58: *           lower triangular part of the array A must contain the lower
                     59: *           triangular part of the symmetric matrix and the strictly
                     60: *           upper triangular part of A is not referenced.
                     61: *           Unchanged on exit.
                     62: *
                     63: *  LDA      (input) INTEGER
                     64: *           On entry, LDA specifies the first dimension of A as declared
                     65: *           in the calling (sub) program. LDA must be at least
                     66: *           max( 1, N ).
                     67: *           Unchanged on exit.
                     68: *
                     69: *  X        (input) COMPLEX*16 array, dimension at least
                     70: *           ( 1 + ( N - 1 )*abs( INCX ) ).
                     71: *           Before entry, the incremented array X must contain the N-
                     72: *           element vector x.
                     73: *           Unchanged on exit.
                     74: *
                     75: *  INCX     (input) INTEGER
                     76: *           On entry, INCX specifies the increment for the elements of
                     77: *           X. INCX must not be zero.
                     78: *           Unchanged on exit.
                     79: *
                     80: *  BETA     (input) COMPLEX*16
                     81: *           On entry, BETA specifies the scalar beta. When BETA is
                     82: *           supplied as zero then Y need not be set on input.
                     83: *           Unchanged on exit.
                     84: *
                     85: *  Y        (input/output) COMPLEX*16 array, dimension at least
                     86: *           ( 1 + ( N - 1 )*abs( INCY ) ).
                     87: *           Before entry, the incremented array Y must contain the n
                     88: *           element vector y. On exit, Y is overwritten by the updated
                     89: *           vector y.
                     90: *
                     91: *  INCY     (input) INTEGER
                     92: *           On entry, INCY specifies the increment for the elements of
                     93: *           Y. INCY must not be zero.
                     94: *           Unchanged on exit.
                     95: *
                     96: * =====================================================================
                     97: *
                     98: *     .. Parameters ..
                     99:       COMPLEX*16         ONE
                    100:       PARAMETER          ( ONE = ( 1.0D+0, 0.0D+0 ) )
                    101:       COMPLEX*16         ZERO
                    102:       PARAMETER          ( ZERO = ( 0.0D+0, 0.0D+0 ) )
                    103: *     ..
                    104: *     .. Local Scalars ..
                    105:       INTEGER            I, INFO, IX, IY, J, JX, JY, KX, KY
                    106:       COMPLEX*16         TEMP1, TEMP2
                    107: *     ..
                    108: *     .. External Functions ..
                    109:       LOGICAL            LSAME
                    110:       EXTERNAL           LSAME
                    111: *     ..
                    112: *     .. External Subroutines ..
                    113:       EXTERNAL           XERBLA
                    114: *     ..
                    115: *     .. Intrinsic Functions ..
                    116:       INTRINSIC          MAX
                    117: *     ..
                    118: *     .. Executable Statements ..
                    119: *
                    120: *     Test the input parameters.
                    121: *
                    122:       INFO = 0
                    123:       IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN
                    124:          INFO = 1
                    125:       ELSE IF( N.LT.0 ) THEN
                    126:          INFO = 2
                    127:       ELSE IF( LDA.LT.MAX( 1, N ) ) THEN
                    128:          INFO = 5
                    129:       ELSE IF( INCX.EQ.0 ) THEN
                    130:          INFO = 7
                    131:       ELSE IF( INCY.EQ.0 ) THEN
                    132:          INFO = 10
                    133:       END IF
                    134:       IF( INFO.NE.0 ) THEN
                    135:          CALL XERBLA( 'ZSYMV ', INFO )
                    136:          RETURN
                    137:       END IF
                    138: *
                    139: *     Quick return if possible.
                    140: *
                    141:       IF( ( N.EQ.0 ) .OR. ( ( ALPHA.EQ.ZERO ) .AND. ( BETA.EQ.ONE ) ) )
                    142:      $   RETURN
                    143: *
                    144: *     Set up the start points in  X  and  Y.
                    145: *
                    146:       IF( INCX.GT.0 ) THEN
                    147:          KX = 1
                    148:       ELSE
                    149:          KX = 1 - ( N-1 )*INCX
                    150:       END IF
                    151:       IF( INCY.GT.0 ) THEN
                    152:          KY = 1
                    153:       ELSE
                    154:          KY = 1 - ( N-1 )*INCY
                    155:       END IF
                    156: *
                    157: *     Start the operations. In this version the elements of A are
                    158: *     accessed sequentially with one pass through the triangular part
                    159: *     of A.
                    160: *
                    161: *     First form  y := beta*y.
                    162: *
                    163:       IF( BETA.NE.ONE ) THEN
                    164:          IF( INCY.EQ.1 ) THEN
                    165:             IF( BETA.EQ.ZERO ) THEN
                    166:                DO 10 I = 1, N
                    167:                   Y( I ) = ZERO
                    168:    10          CONTINUE
                    169:             ELSE
                    170:                DO 20 I = 1, N
                    171:                   Y( I ) = BETA*Y( I )
                    172:    20          CONTINUE
                    173:             END IF
                    174:          ELSE
                    175:             IY = KY
                    176:             IF( BETA.EQ.ZERO ) THEN
                    177:                DO 30 I = 1, N
                    178:                   Y( IY ) = ZERO
                    179:                   IY = IY + INCY
                    180:    30          CONTINUE
                    181:             ELSE
                    182:                DO 40 I = 1, N
                    183:                   Y( IY ) = BETA*Y( IY )
                    184:                   IY = IY + INCY
                    185:    40          CONTINUE
                    186:             END IF
                    187:          END IF
                    188:       END IF
                    189:       IF( ALPHA.EQ.ZERO )
                    190:      $   RETURN
                    191:       IF( LSAME( UPLO, 'U' ) ) THEN
                    192: *
                    193: *        Form  y  when A is stored in upper triangle.
                    194: *
                    195:          IF( ( INCX.EQ.1 ) .AND. ( INCY.EQ.1 ) ) THEN
                    196:             DO 60 J = 1, N
                    197:                TEMP1 = ALPHA*X( J )
                    198:                TEMP2 = ZERO
                    199:                DO 50 I = 1, J - 1
                    200:                   Y( I ) = Y( I ) + TEMP1*A( I, J )
                    201:                   TEMP2 = TEMP2 + A( I, J )*X( I )
                    202:    50          CONTINUE
                    203:                Y( J ) = Y( J ) + TEMP1*A( J, J ) + ALPHA*TEMP2
                    204:    60       CONTINUE
                    205:          ELSE
                    206:             JX = KX
                    207:             JY = KY
                    208:             DO 80 J = 1, N
                    209:                TEMP1 = ALPHA*X( JX )
                    210:                TEMP2 = ZERO
                    211:                IX = KX
                    212:                IY = KY
                    213:                DO 70 I = 1, J - 1
                    214:                   Y( IY ) = Y( IY ) + TEMP1*A( I, J )
                    215:                   TEMP2 = TEMP2 + A( I, J )*X( IX )
                    216:                   IX = IX + INCX
                    217:                   IY = IY + INCY
                    218:    70          CONTINUE
                    219:                Y( JY ) = Y( JY ) + TEMP1*A( J, J ) + ALPHA*TEMP2
                    220:                JX = JX + INCX
                    221:                JY = JY + INCY
                    222:    80       CONTINUE
                    223:          END IF
                    224:       ELSE
                    225: *
                    226: *        Form  y  when A is stored in lower triangle.
                    227: *
                    228:          IF( ( INCX.EQ.1 ) .AND. ( INCY.EQ.1 ) ) THEN
                    229:             DO 100 J = 1, N
                    230:                TEMP1 = ALPHA*X( J )
                    231:                TEMP2 = ZERO
                    232:                Y( J ) = Y( J ) + TEMP1*A( J, J )
                    233:                DO 90 I = J + 1, N
                    234:                   Y( I ) = Y( I ) + TEMP1*A( I, J )
                    235:                   TEMP2 = TEMP2 + A( I, J )*X( I )
                    236:    90          CONTINUE
                    237:                Y( J ) = Y( J ) + ALPHA*TEMP2
                    238:   100       CONTINUE
                    239:          ELSE
                    240:             JX = KX
                    241:             JY = KY
                    242:             DO 120 J = 1, N
                    243:                TEMP1 = ALPHA*X( JX )
                    244:                TEMP2 = ZERO
                    245:                Y( JY ) = Y( JY ) + TEMP1*A( J, J )
                    246:                IX = JX
                    247:                IY = JY
                    248:                DO 110 I = J + 1, N
                    249:                   IX = IX + INCX
                    250:                   IY = IY + INCY
                    251:                   Y( IY ) = Y( IY ) + TEMP1*A( I, J )
                    252:                   TEMP2 = TEMP2 + A( I, J )*X( IX )
                    253:   110          CONTINUE
                    254:                Y( JY ) = Y( JY ) + ALPHA*TEMP2
                    255:                JX = JX + INCX
                    256:                JY = JY + INCY
                    257:   120       CONTINUE
                    258:          END IF
                    259:       END IF
                    260: *
                    261:       RETURN
                    262: *
                    263: *     End of ZSYMV
                    264: *
                    265:       END

CVSweb interface <joel.bertrand@systella.fr>