1 SUBROUTINE DSPR
( UPLO
, N
, ALPHA
, X
, INCX
, AP
)
2 * .. Scalar Arguments
..
6 * .. Array Arguments
..
7 DOUBLE PRECISION AP
( * ), X
( * )
13 * DSPR 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, supplied in packed form.
24 * On entry, UPLO specifies whether the upper or lower
25 * triangular part of the matrix A is supplied in the packed
26 * array AP as follows:
28 * UPLO = 'U
' or 'u
' The upper triangular part of A is
31 * UPLO = 'L
' or 'l
' The lower triangular part of A is
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 * AP - DOUBLE PRECISION array of DIMENSION at least
57 * ( ( n*( n + 1 ) )/2 ).
58 * Before entry with UPLO = 'U
' or 'u
', the array AP must
59 * contain the upper triangular part of the symmetric matrix
60 * packed sequentially, column by column, so that AP( 1 )
61 * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
62 * and a( 2, 2 ) respectively, and so on. On exit, the array
63 * AP is overwritten by the upper triangular part of the
65 * Before entry with UPLO = 'L
' or 'l
', the array AP must
66 * contain the lower 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( 2, 1 )
69 * and a( 3, 1 ) respectively, and so on. On exit, the array
70 * AP is overwritten by the lower triangular part of the
74 * Level 2 Blas routine.
76 * -- Written on 22-October-1986.
77 * Jack Dongarra, Argonne National Lab.
78 * Jeremy Du Croz, Nag Central Office.
79 * Sven Hammarling, Nag Central Office.
80 * Richard Hanson, Sandia National Labs.
85 PARAMETER ( ZERO = 0.0D+0 )
88 INTEGER I, INFO, IX, J, JX, K, KK, KX
89 * .. External Functions ..
92 * .. External Subroutines ..
95 * .. Executable Statements ..
97 * Test the input parameters.
100 IF ( .NOT.LSAME( UPLO, 'U
' ).AND.
101 $ .NOT.LSAME( UPLO, 'L
' ) )THEN
103 ELSE IF( N.LT.0 )THEN
105 ELSE IF( INCX.EQ.0 )THEN
109 CALL XERBLA( 'DSPR
', INFO )
113 * Quick return if possible.
115 IF( ( N.EQ.0 ).OR.( ALPHA.EQ.ZERO ) )
118 * Set the start point in X if the increment is not unity.
121 KX = 1 - ( N - 1 )*INCX
122 ELSE IF( INCX.NE.1 )THEN
126 * Start the operations. In this version the elements of the array AP
127 * are accessed sequentially with one pass through AP.
130 IF( LSAME( UPLO, 'U
' ) )THEN
132 * Form A when upper triangle is stored in AP.
136 IF( X( J ).NE.ZERO )THEN
140 AP( K ) = AP( K ) + X( I )*TEMP
149 IF( X( JX ).NE.ZERO )THEN
152 DO 30, K = KK, KK + J - 1
153 AP( K ) = AP( K ) + X( IX )*TEMP
163 * Form A when lower triangle is stored in AP.
167 IF( X( J ).NE.ZERO )THEN
171 AP( K ) = AP( K ) + X( I )*TEMP
180 IF( X( JX ).NE.ZERO )THEN
183 DO 70, K = KK, KK + N - J
184 AP( K ) = AP( K ) + X( IX )*TEMP