1 SUBROUTINE DSYMV ( UPLO, N, ALPHA, A, LDA, X, INCX, &
3 ! .. Scalar Arguments ..
4 DOUBLE PRECISION ALPHA, BETA
5 INTEGER INCX, INCY, LDA, N
7 ! .. Array Arguments ..
8 DOUBLE PRECISION A( LDA, * ), X( * ), Y( * )
14 ! DSYMV performs the matrix-vector operation
16 ! y := alpha*A*x + beta*y,
18 ! where alpha and beta are scalars, x and y are n element vectors and
19 ! A is an n by n symmetric matrix.
25 ! On entry, UPLO specifies whether the upper or lower
26 ! triangular part of the array A is to be referenced as
29 ! UPLO = 'U' or 'u' Only the upper triangular part of A
30 ! is to be referenced.
32 ! UPLO = 'L' or 'l' Only the lower triangular part of A
33 ! is to be referenced.
38 ! On entry, N specifies the order of the matrix A.
39 ! N must be at least zero.
42 ! ALPHA - DOUBLE PRECISION.
43 ! On entry, ALPHA specifies the scalar alpha.
46 ! A - DOUBLE PRECISION array of DIMENSION ( LDA, n ).
47 ! Before entry with UPLO = 'U' or 'u', the leading n by n
48 ! upper triangular part of the array A must contain the upper
49 ! triangular part of the symmetric matrix and the strictly
50 ! lower triangular part of A is not referenced.
51 ! Before entry with UPLO = 'L' or 'l', the leading n by n
52 ! lower triangular part of the array A must contain the lower
53 ! triangular part of the symmetric matrix and the strictly
54 ! upper triangular part of A is not referenced.
58 ! On entry, LDA specifies the first dimension of A as declared
59 ! in the calling (sub) program. LDA must be at least
63 ! X - DOUBLE PRECISION array of dimension at least
64 ! ( 1 + ( n - 1 )*abs( INCX ) ).
65 ! Before entry, the incremented array X must contain the n
70 ! On entry, INCX specifies the increment for the elements of
71 ! X. INCX must not be zero.
74 ! BETA - DOUBLE PRECISION.
75 ! On entry, BETA specifies the scalar beta. When BETA is
76 ! supplied as zero then Y need not be set on input.
79 ! Y - DOUBLE PRECISION array of dimension at least
80 ! ( 1 + ( n - 1 )*abs( INCY ) ).
81 ! Before entry, the incremented array Y must contain the n
82 ! element vector y. On exit, Y is overwritten by the updated
86 ! On entry, INCY specifies the increment for the elements of
87 ! Y. INCY must not be zero.
91 ! Level 2 Blas routine.
93 ! -- Written on 22-October-1986.
94 ! Jack Dongarra, Argonne National Lab.
95 ! Jeremy Du Croz, Nag Central Office.
96 ! Sven Hammarling, Nag Central Office.
97 ! Richard Hanson, Sandia National Labs.
101 DOUBLE PRECISION ONE , ZERO
102 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
103 ! .. Local Scalars ..
104 DOUBLE PRECISION TEMP1, TEMP2
105 INTEGER I, INFO, IX, IY, J, JX, JY, KX, KY
106 ! .. External Functions ..
109 ! .. External Subroutines ..
111 ! .. Intrinsic Functions ..
114 ! .. Executable Statements ..
116 ! Test the input parameters.
119 IF ( .NOT.LSAME( UPLO, 'U' ).AND. &
120 .NOT.LSAME( UPLO, 'L' ) )THEN
122 ELSE IF( N.LT.0 )THEN
124 ELSE IF( LDA.LT.MAX( 1, N ) )THEN
126 ELSE IF( INCX.EQ.0 )THEN
128 ELSE IF( INCY.EQ.0 )THEN
132 CALL XERBLA( 'DSYMV ', INFO )
136 ! Quick return if possible.
138 IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) ) &
141 ! Set up the start points in X and Y.
146 KX = 1 - ( N - 1 )*INCX
151 KY = 1 - ( N - 1 )*INCY
154 ! Start the operations. In this version the elements of A are
155 ! accessed sequentially with one pass through the triangular part
158 ! First form y := beta*y.
160 IF( BETA.NE.ONE )THEN
162 IF( BETA.EQ.ZERO )THEN
173 IF( BETA.EQ.ZERO )THEN
180 Y( IY ) = BETA*Y( IY )
186 IF( ALPHA.EQ.ZERO ) &
188 IF( LSAME( UPLO, 'U' ) )THEN
190 ! Form y when A is stored in upper triangle.
192 IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
197 Y( I ) = Y( I ) + TEMP1*A( I, J )
198 TEMP2 = TEMP2 + A( I, J )*X( I )
200 Y( J ) = Y( J ) + TEMP1*A( J, J ) + ALPHA*TEMP2
206 TEMP1 = ALPHA*X( JX )
211 Y( IY ) = Y( IY ) + TEMP1*A( I, J )
212 TEMP2 = TEMP2 + A( I, J )*X( IX )
216 Y( JY ) = Y( JY ) + TEMP1*A( J, J ) + ALPHA*TEMP2
223 ! Form y when A is stored in lower triangle.
225 IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
229 Y( J ) = Y( J ) + TEMP1*A( J, J )
231 Y( I ) = Y( I ) + TEMP1*A( I, J )
232 TEMP2 = TEMP2 + A( I, J )*X( I )
234 Y( J ) = Y( J ) + ALPHA*TEMP2
240 TEMP1 = ALPHA*X( JX )
242 Y( JY ) = Y( JY ) + TEMP1*A( J, J )
248 Y( IY ) = Y( IY ) + TEMP1*A( I, J )
249 TEMP2 = TEMP2 + A( I, J )*X( IX )
251 Y( JY ) = Y( JY ) + ALPHA*TEMP2