3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
11 * SUBROUTINE DSPR2(UPLO,N,ALPHA,X,INCX,Y,INCY,AP)
13 * .. Scalar Arguments ..
14 * DOUBLE PRECISION ALPHA
18 * .. Array Arguments ..
19 * DOUBLE PRECISION AP(*),X(*),Y(*)
28 *> DSPR2 performs the symmetric rank 2 operation
30 *> A := alpha*x*y**T + alpha*y*x**T + A,
32 *> where alpha is a scalar, x and y are n element vectors and A is an
33 *> n by n symmetric matrix, supplied in packed form.
41 *> UPLO is CHARACTER*1
42 *> On entry, UPLO specifies whether the upper or lower
43 *> triangular part of the matrix A is supplied in the packed
44 *> array AP as follows:
46 *> UPLO = 'U' or 'u' The upper triangular part of A is
49 *> UPLO = 'L' or 'l' The lower triangular part of A is
56 *> On entry, N specifies the order of the matrix A.
57 *> N must be at least zero.
62 *> ALPHA is DOUBLE PRECISION.
63 *> On entry, ALPHA specifies the scalar alpha.
68 *> X is DOUBLE PRECISION array of dimension at least
69 *> ( 1 + ( n - 1 )*abs( INCX ) ).
70 *> Before entry, the incremented array X must contain the n
77 *> On entry, INCX specifies the increment for the elements of
78 *> X. INCX must not be zero.
83 *> Y is DOUBLE PRECISION array of dimension at least
84 *> ( 1 + ( n - 1 )*abs( INCY ) ).
85 *> Before entry, the incremented array Y must contain the n
92 *> On entry, INCY specifies the increment for the elements of
93 *> Y. INCY must not be zero.
98 *> AP is DOUBLE PRECISION array of DIMENSION at least
99 *> ( ( n*( n + 1 ) )/2 ).
100 *> Before entry with UPLO = 'U' or 'u', the array AP must
101 *> contain the upper triangular part of the symmetric matrix
102 *> packed sequentially, column by column, so that AP( 1 )
103 *> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
104 *> and a( 2, 2 ) respectively, and so on. On exit, the array
105 *> AP is overwritten by the upper triangular part of the
107 *> Before entry with UPLO = 'L' or 'l', the array AP must
108 *> contain the lower triangular part of the symmetric matrix
109 *> packed sequentially, column by column, so that AP( 1 )
110 *> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
111 *> and a( 3, 1 ) respectively, and so on. On exit, the array
112 *> AP is overwritten by the lower triangular part of the
119 *> \author Univ. of Tennessee
120 *> \author Univ. of California Berkeley
121 *> \author Univ. of Colorado Denver
124 *> \date November 2011
126 *> \ingroup double_blas_level2
128 *> \par Further Details:
129 * =====================
133 *> Level 2 Blas routine.
135 *> -- Written on 22-October-1986.
136 *> Jack Dongarra, Argonne National Lab.
137 *> Jeremy Du Croz, Nag Central Office.
138 *> Sven Hammarling, Nag Central Office.
139 *> Richard Hanson, Sandia National Labs.
142 * =====================================================================
143 SUBROUTINE DSPR2(UPLO,N,ALPHA,X,INCX,Y,INCY,AP)
145 * -- Reference BLAS level2 routine (version 3.4.0) --
146 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
147 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
150 * .. Scalar Arguments ..
151 DOUBLE PRECISION ALPHA
155 * .. Array Arguments ..
156 DOUBLE PRECISION AP(*),X(*),Y(*)
159 * =====================================================================
162 DOUBLE PRECISION ZERO
163 PARAMETER (ZERO=0.0D+0)
165 * .. Local Scalars ..
166 DOUBLE PRECISION TEMP1,TEMP2
167 INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY
169 * .. External Functions ..
173 * .. External Subroutines ..
177 * Test the input parameters.
180 IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
182 ELSE IF (N.LT.0) THEN
184 ELSE IF (INCX.EQ.0) THEN
186 ELSE IF (INCY.EQ.0) THEN
190 CALL XERBLA('DSPR2 ',INFO)
194 * Quick return if possible.
196 IF ((N.EQ.0) .OR. (ALPHA.EQ.ZERO)) RETURN
198 * Set up the start points in X and Y if the increments are not both
201 IF ((INCX.NE.1) .OR. (INCY.NE.1)) THEN
216 * Start the operations. In this version the elements of the array AP
217 * are accessed sequentially with one pass through AP.
220 IF (LSAME(UPLO,'U')) THEN
222 * Form A when upper triangle is stored in AP.
224 IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
226 IF ((X(J).NE.ZERO) .OR. (Y(J).NE.ZERO)) THEN
231 AP(K) = AP(K) + X(I)*TEMP1 + Y(I)*TEMP2
239 IF ((X(JX).NE.ZERO) .OR. (Y(JY).NE.ZERO)) THEN
244 DO 30 K = KK,KK + J - 1
245 AP(K) = AP(K) + X(IX)*TEMP1 + Y(IY)*TEMP2
257 * Form A when lower triangle is stored in AP.
259 IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
261 IF ((X(J).NE.ZERO) .OR. (Y(J).NE.ZERO)) THEN
266 AP(K) = AP(K) + X(I)*TEMP1 + Y(I)*TEMP2
274 IF ((X(JX).NE.ZERO) .OR. (Y(JY).NE.ZERO)) THEN
279 DO 70 K = KK,KK + N - J
280 AP(K) = AP(K) + X(IX)*TEMP1 + Y(IY)*TEMP2