1
SUBROUTINE SSPMV ( UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY )
3
* $Id: sspmv.f 19695 2010-10-29 16:51:02Z d3y133 $
3
* =========== DOCUMENTATION ===========
5
* Online html documentation available at
6
* http://www.netlib.org/lapack/explore-html/
11
* SUBROUTINE SSPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)
13
* .. Scalar Arguments ..
18
* .. Array Arguments ..
19
* REAL AP(*),X(*),Y(*)
28
*> SSPMV performs the matrix-vector operation
30
*> y := alpha*A*x + beta*y,
32
*> where alpha and beta are scalars, x and y are n element vectors and
33
*> A is an 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.
63
*> On entry, ALPHA specifies the scalar alpha.
68
*> AP is REAL array of DIMENSION at least
69
*> ( ( n*( n + 1 ) )/2 ).
70
*> Before entry with UPLO = 'U' or 'u', the array AP must
71
*> contain the upper triangular part of the symmetric matrix
72
*> packed sequentially, column by column, so that AP( 1 )
73
*> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
74
*> and a( 2, 2 ) respectively, and so on.
75
*> Before entry with UPLO = 'L' or 'l', the array AP must
76
*> contain the lower triangular part of the symmetric matrix
77
*> packed sequentially, column by column, so that AP( 1 )
78
*> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
79
*> and a( 3, 1 ) respectively, and so on.
84
*> X is REAL array of dimension at least
85
*> ( 1 + ( n - 1 )*abs( INCX ) ).
86
*> Before entry, the incremented array X must contain the n
93
*> On entry, INCX specifies the increment for the elements of
94
*> X. INCX must not be zero.
100
*> On entry, BETA specifies the scalar beta. When BETA is
101
*> supplied as zero then Y need not be set on input.
106
*> Y is REAL array of dimension at least
107
*> ( 1 + ( n - 1 )*abs( INCY ) ).
108
*> Before entry, the incremented array Y must contain the n
109
*> element vector y. On exit, Y is overwritten by the updated
116
*> On entry, INCY specifies the increment for the elements of
117
*> Y. INCY must not be zero.
123
*> \author Univ. of Tennessee
124
*> \author Univ. of California Berkeley
125
*> \author Univ. of Colorado Denver
128
*> \date November 2011
130
*> \ingroup single_blas_level2
132
*> \par Further Details:
133
* =====================
137
*> Level 2 Blas routine.
138
*> The vector and matrix arguments are not referenced when N = 0, or M = 0
140
*> -- Written on 22-October-1986.
141
*> Jack Dongarra, Argonne National Lab.
142
*> Jeremy Du Croz, Nag Central Office.
143
*> Sven Hammarling, Nag Central Office.
144
*> Richard Hanson, Sandia National Labs.
147
* =====================================================================
148
SUBROUTINE SSPMV(UPLO,N,ALPHA,AP,X,INCX,BETA,Y,INCY)
150
* -- Reference BLAS level2 routine (version 3.4.0) --
151
* -- Reference BLAS is a software package provided by Univ. of Tennessee, --
152
* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
5
155
* .. Scalar Arguments ..
9
160
* .. Array Arguments ..
10
REAL AP( * ), X( * ), Y( * )
16
* SSPMV performs the matrix-vector operation
18
* y := alpha*A*x + beta*y,
20
* where alpha and beta are scalars, x and y are n element vectors and
21
* A is an n by n symmetric matrix, supplied in packed form.
27
* On entry, UPLO specifies whether the upper or lower
28
* triangular part of the matrix A is supplied in the packed
29
* array AP as follows:
31
* UPLO = 'U' or 'u' The upper triangular part of A is
34
* UPLO = 'L' or 'l' The lower triangular part of A is
40
* On entry, N specifies the order of the matrix A.
41
* N must be at least zero.
45
* On entry, ALPHA specifies the scalar alpha.
48
* AP - REAL array of DIMENSION at least
49
* ( ( n*( n + 1 ) )/2 ).
50
* Before entry with UPLO = 'U' or 'u', the array AP must
51
* contain the upper triangular part of the symmetric matrix
52
* packed sequentially, column by column, so that AP( 1 )
53
* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 )
54
* and a( 2, 2 ) respectively, and so on.
55
* Before entry with UPLO = 'L' or 'l', the array AP must
56
* contain the lower triangular part of the symmetric matrix
57
* packed sequentially, column by column, so that AP( 1 )
58
* contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 )
59
* and a( 3, 1 ) respectively, and so on.
62
* X - REAL array of dimension at least
63
* ( 1 + ( n - 1 )*abs( INCX ) ).
64
* Before entry, the incremented array X must contain the n
69
* On entry, INCX specifies the increment for the elements of
70
* X. INCX must not be zero.
74
* On entry, BETA specifies the scalar beta. When BETA is
75
* supplied as zero then Y need not be set on input.
78
* Y - REAL array of dimension at least
79
* ( 1 + ( n - 1 )*abs( INCY ) ).
80
* Before entry, the incremented array Y must contain the n
81
* element vector y. On exit, Y is overwritten by the updated
85
* On entry, INCY specifies the increment for the elements of
86
* Y. INCY must not be zero.
90
* Level 2 Blas routine.
92
* -- Written on 22-October-1986.
93
* Jack Dongarra, Argonne National Lab.
94
* Jeremy Du Croz, Nag Central Office.
95
* Sven Hammarling, Nag Central Office.
96
* Richard Hanson, Sandia National Labs.
164
* =====================================================================
99
166
* .. Parameters ..
101
PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
168
PARAMETER (ONE=1.0E+0,ZERO=0.0E+0)
102
170
* .. Local Scalars ..
104
INTEGER I, INFO, IX, IY, J, JX, JY, K, KK, KX, KY
172
INTEGER I,INFO,IX,IY,J,JX,JY,K,KK,KX,KY
105
174
* .. External Functions ..
108
178
* .. External Subroutines ..
111
* .. Executable Statements ..
113
182
* Test the input parameters.
116
IF ( .NOT.LSAME( UPLO, 'U' ).AND.
117
$ .NOT.LSAME( UPLO, 'L' ) )THEN
119
ELSE IF( N.LT.0 )THEN
121
ELSE IF( INCX.EQ.0 )THEN
123
ELSE IF( INCY.EQ.0 )THEN
185
IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
187
ELSE IF (N.LT.0) THEN
189
ELSE IF (INCX.EQ.0) THEN
191
ELSE IF (INCY.EQ.0) THEN
127
CALL XERBLA( 'SSPMV ', INFO )
195
CALL XERBLA('SSPMV ',INFO)
131
199
* Quick return if possible.
133
IF( ( N.EQ.0 ).OR.( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) ) )
201
IF ((N.EQ.0) .OR. ((ALPHA.EQ.ZERO).AND. (BETA.EQ.ONE))) RETURN
136
203
* Set up the start points in X and Y.
141
KX = 1 - ( N - 1 )*INCX
146
KY = 1 - ( N - 1 )*INCY
149
216
* Start the operations. In this version the elements of the array AP
152
219
* First form y := beta*y.
154
IF( BETA.NE.ONE )THEN
156
IF( BETA.EQ.ZERO )THEN
167
IF( BETA.EQ.ZERO )THEN
174
Y( IY ) = BETA*Y( IY )
221
IF (BETA.NE.ONE) THEN
223
IF (BETA.EQ.ZERO) THEN
234
IF (BETA.EQ.ZERO) THEN
247
IF (ALPHA.EQ.ZERO) RETURN
183
IF( LSAME( UPLO, 'U' ) )THEN
249
IF (LSAME(UPLO,'U')) THEN
185
251
* Form y when AP contains the upper triangle.
187
IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
193
Y( I ) = Y( I ) + TEMP1*AP( K )
194
TEMP2 = TEMP2 + AP( K )*X( I )
197
Y( J ) = Y( J ) + TEMP1*AP( KK + J - 1 ) + ALPHA*TEMP2
204
TEMP1 = ALPHA*X( JX )
208
DO 70, K = KK, KK + J - 2
209
Y( IY ) = Y( IY ) + TEMP1*AP( K )
210
TEMP2 = TEMP2 + AP( K )*X( IX )
214
Y( JY ) = Y( JY ) + TEMP1*AP( KK + J - 1 ) + ALPHA*TEMP2
253
IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
259
Y(I) = Y(I) + TEMP1*AP(K)
260
TEMP2 = TEMP2 + AP(K)*X(I)
263
Y(J) = Y(J) + TEMP1*AP(KK+J-1) + ALPHA*TEMP2
274
DO 70 K = KK,KK + J - 2
275
Y(IY) = Y(IY) + TEMP1*AP(K)
276
TEMP2 = TEMP2 + AP(K)*X(IX)
280
Y(JY) = Y(JY) + TEMP1*AP(KK+J-1) + ALPHA*TEMP2
222
288
* Form y when AP contains the lower triangle.
224
IF( ( INCX.EQ.1 ).AND.( INCY.EQ.1 ) )THEN
228
Y( J ) = Y( J ) + TEMP1*AP( KK )
231
Y( I ) = Y( I ) + TEMP1*AP( K )
232
TEMP2 = TEMP2 + AP( K )*X( I )
235
Y( J ) = Y( J ) + ALPHA*TEMP2
236
KK = KK + ( N - J + 1 )
242
TEMP1 = ALPHA*X( JX )
244
Y( JY ) = Y( JY ) + TEMP1*AP( KK )
247
DO 110, K = KK + 1, KK + N - J
250
Y( IY ) = Y( IY ) + TEMP1*AP( K )
251
TEMP2 = TEMP2 + AP( K )*X( IX )
253
Y( JY ) = Y( JY ) + ALPHA*TEMP2
256
KK = KK + ( N - J + 1 )
290
IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
294
Y(J) = Y(J) + TEMP1*AP(KK)
297
Y(I) = Y(I) + TEMP1*AP(K)
298
TEMP2 = TEMP2 + AP(K)*X(I)
301
Y(J) = Y(J) + ALPHA*TEMP2
310
Y(JY) = Y(JY) + TEMP1*AP(KK)
313
DO 110 K = KK + 1,KK + N - J
316
Y(IY) = Y(IY) + TEMP1*AP(K)
317
TEMP2 = TEMP2 + AP(K)*X(IX)
319
Y(JY) = Y(JY) + ALPHA*TEMP2