1 SUBROUTINE DSYR
( UPLO
, N
, ALPHA
, X
, INCX
, A
, LDA
)
2 * .. Scalar Arguments
..
6 * .. Array Arguments
..
7 DOUBLE PRECISION A
( LDA
, * ), X
( * )
13 * DSYR performs the symmetric rank
1 operation
15 * A
:= alpha*x*x
' + A,
17 * where alpha is a real scalar, x is an n element vector and A is an
18 * n by n symmetric matrix.
24 * On entry, UPLO specifies whether the upper or lower
25 * triangular part of the array A is to be referenced as
28 * UPLO = 'U
' or 'u
' Only the upper triangular part of A
29 * is to be referenced.
31 * UPLO = 'L
' or 'l
' Only the lower triangular part of A
32 * is to be referenced.
37 * On entry, N specifies the order of the matrix A.
38 * N must be at least zero.
41 * ALPHA - DOUBLE PRECISION.
42 * On entry, ALPHA specifies the scalar alpha.
45 * X - DOUBLE PRECISION array of dimension at least
46 * ( 1 + ( n - 1 )*abs( INCX ) ).
47 * Before entry, the incremented array X must contain the n
52 * On entry, INCX specifies the increment for the elements of
53 * X. INCX must not be zero.
56 * A - DOUBLE PRECISION array of DIMENSION ( LDA, n ).
57 * Before entry with UPLO = 'U
' or 'u
', the leading n by n
58 * upper triangular part of the array A must contain the upper
59 * triangular part of the symmetric matrix and the strictly
60 * lower triangular part of A is not referenced. On exit, the
61 * upper triangular part of the array A is overwritten by the
62 * upper triangular part of the updated matrix.
63 * Before entry with UPLO = 'L
' or 'l
', the leading n by n
64 * lower triangular part of the array A must contain the lower
65 * triangular part of the symmetric matrix and the strictly
66 * upper triangular part of A is not referenced. On exit, the
67 * lower triangular part of the array A is overwritten by the
68 * lower triangular part of the updated matrix.
71 * On entry, LDA specifies the first dimension of A as declared
72 * in the calling (sub) program. LDA must be at least
77 * Level 2 Blas routine.
79 * -- Written on 22-October-1986.
80 * Jack Dongarra, Argonne National Lab.
81 * Jeremy Du Croz, Nag Central Office.
82 * Sven Hammarling, Nag Central Office.
83 * Richard Hanson, Sandia National Labs.
88 PARAMETER ( ZERO = 0.0D+0 )
91 INTEGER I, INFO, IX, J, JX, KX
92 * .. External Functions ..
95 * .. External Subroutines ..
97 * .. Intrinsic Functions ..
100 * .. Executable Statements ..
102 * Test the input parameters.
105 IF ( .NOT.LSAME( UPLO, 'U
' ).AND.
106 $ .NOT.LSAME( UPLO, 'L
' ) )THEN
108 ELSE IF( N.LT.0 )THEN
110 ELSE IF( INCX.EQ.0 )THEN
112 ELSE IF( LDA.LT.MAX( 1, N ) )THEN
116 CALL XERBLA( 'DSYR
', INFO )
120 * Quick return if possible.
122 IF( ( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )
125 * Set the start point in X if the increment is not unity.
128 KX = 1 - ( N - 1 )*INCX
129 ELSE IF( INCX.NE.1 )THEN
133 * Start the operations. In this version the elements of A are
134 * accessed sequentially with one pass through the triangular part
137 IF( LSAME( UPLO, 'U
' ) )THEN
139 * Form A when A is stored in upper triangle.
143 IF( X( J ).NE.ZERO )THEN
146 A( I, J ) = A( I, J ) + X( I )*TEMP
153 IF( X( JX ).NE.ZERO )THEN
157 A( I, J ) = A( I, J ) + X( IX )*TEMP
166 * Form A when A is stored in lower triangle.
170 IF( X( J ).NE.ZERO )THEN
173 A( I, J ) = A( I, J ) + X( I )*TEMP
180 IF( X( JX ).NE.ZERO )THEN
184 A( I, J ) = A( I, J ) + X( IX )*TEMP