1 SUBROUTINE DSPR
(UPLO
,N
,ALPHA
,X
,INCX
,AP
)
2 * .. Scalar Arguments
..
7 * .. Array Arguments
..
8 DOUBLE PRECISION AP
(*),X
(*)
14 * DSPR performs the symmetric rank
1 operation
16 * A
:= alpha*x*x
' + A,
18 * where alpha is a real scalar, x is an n element vector and A is an
19 * n by n symmetric matrix, supplied in packed form.
25 * On entry, UPLO specifies whether the upper or lower
26 * triangular part of the matrix A is supplied in the packed
27 * array AP as follows:
29 * UPLO = 'U
' or 'u
' The upper triangular part of A is
32 * UPLO = 'L
' or 'l
' The lower triangular part of A is
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 * X - DOUBLE PRECISION array of dimension at least
47 * ( 1 + ( n - 1 )*abs( INCX ) ).
48 * Before entry, the incremented array X must contain the n
53 * On entry, INCX specifies the increment for the elements of
54 * X. INCX must not be zero.
57 * AP - DOUBLE PRECISION array of DIMENSION at least
58 * ( ( n*( n + 1 ) )/2 ).
59 * Before entry with UPLO = 'U
' or 'u
', the array AP must
60 * contain the upper triangular part of the symmetric matrix
61 * packed sequentially, column by column, so that AP( 1 )
62 * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
63 * and a( 2, 2 ) respectively, and so on. On exit, the array
64 * AP is overwritten by the upper triangular part of the
66 * Before entry with UPLO = 'L
' or 'l
', the array AP must
67 * contain the lower triangular part of the symmetric matrix
68 * packed sequentially, column by column, so that AP( 1 )
69 * contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
70 * and a( 3, 1 ) respectively, and so on. On exit, the array
71 * AP is overwritten by the lower triangular part of the
75 * Level 2 Blas routine.
77 * -- Written on 22-October-1986.
78 * Jack Dongarra, Argonne National Lab.
79 * Jeremy Du Croz, Nag Central Office.
80 * Sven Hammarling, Nag Central Office.
81 * Richard Hanson, Sandia National Labs.
86 PARAMETER (ZERO=0.0D+0)
90 INTEGER I,INFO,IX,J,JX,K,KK,KX
92 * .. External Functions ..
96 * .. External Subroutines ..
100 * Test the input parameters.
103 IF (.NOT.LSAME(UPLO,'U
') .AND. .NOT.LSAME(UPLO,'L
')) THEN
105 ELSE IF (N.LT.0) THEN
107 ELSE IF (INCX.EQ.0) THEN
111 CALL XERBLA('DSPR
',INFO)
115 * Quick return if possible.
117 IF ((N.EQ.0) .OR. (ALPHA.EQ.ZERO)) RETURN
119 * Set the start point in X if the increment is not unity.
123 ELSE IF (INCX.NE.1) THEN
127 * Start the operations. In this version the elements of the array AP
128 * are accessed sequentially with one pass through AP.
131 IF (LSAME(UPLO,'U
')) THEN
133 * Form A when upper triangle is stored in AP.
137 IF (X(J).NE.ZERO) THEN
141 AP(K) = AP(K) + X(I)*TEMP
150 IF (X(JX).NE.ZERO) THEN
153 DO 30 K = KK,KK + J - 1
154 AP(K) = AP(K) + X(IX)*TEMP
164 * Form A when lower triangle is stored in AP.
168 IF (X(J).NE.ZERO) THEN
172 AP(K) = AP(K) + X(I)*TEMP
181 IF (X(JX).NE.ZERO) THEN
184 DO 70 K = KK,KK + N - J
185 AP(K) = AP(K) + X(IX)*TEMP