![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b CSPMV 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download CSPMV + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/cspmv.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/cspmv.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/cspmv.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * SUBROUTINE CSPMV( UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY ) 00022 * 00023 * .. Scalar Arguments .. 00024 * CHARACTER UPLO 00025 * INTEGER INCX, INCY, N 00026 * COMPLEX ALPHA, BETA 00027 * .. 00028 * .. Array Arguments .. 00029 * COMPLEX AP( * ), X( * ), Y( * ) 00030 * .. 00031 * 00032 * 00033 *> \par Purpose: 00034 * ============= 00035 *> 00036 *> \verbatim 00037 *> 00038 *> CSPMV performs the matrix-vector operation 00039 *> 00040 *> y := alpha*A*x + beta*y, 00041 *> 00042 *> where alpha and beta are scalars, x and y are n element vectors and 00043 *> A is an n by n symmetric matrix, supplied in packed form. 00044 *> \endverbatim 00045 * 00046 * Arguments: 00047 * ========== 00048 * 00049 *> \param[in] UPLO 00050 *> \verbatim 00051 *> UPLO is CHARACTER*1 00052 *> On entry, UPLO specifies whether the upper or lower 00053 *> triangular part of the matrix A is supplied in the packed 00054 *> array AP as follows: 00055 *> 00056 *> UPLO = 'U' or 'u' The upper triangular part of A is 00057 *> supplied in AP. 00058 *> 00059 *> UPLO = 'L' or 'l' The lower triangular part of A is 00060 *> supplied in AP. 00061 *> 00062 *> Unchanged on exit. 00063 *> \endverbatim 00064 *> 00065 *> \param[in] N 00066 *> \verbatim 00067 *> N is INTEGER 00068 *> On entry, N specifies the order of the matrix A. 00069 *> N must be at least zero. 00070 *> Unchanged on exit. 00071 *> \endverbatim 00072 *> 00073 *> \param[in] ALPHA 00074 *> \verbatim 00075 *> ALPHA is COMPLEX 00076 *> On entry, ALPHA specifies the scalar alpha. 00077 *> Unchanged on exit. 00078 *> \endverbatim 00079 *> 00080 *> \param[in] AP 00081 *> \verbatim 00082 *> AP is COMPLEX array, dimension at least 00083 *> ( ( N*( N + 1 ) )/2 ). 00084 *> Before entry, with UPLO = 'U' or 'u', the array AP must 00085 *> contain the upper triangular part of the symmetric matrix 00086 *> packed sequentially, column by column, so that AP( 1 ) 00087 *> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 1, 2 ) 00088 *> and a( 2, 2 ) respectively, and so on. 00089 *> Before entry, with UPLO = 'L' or 'l', the array AP must 00090 *> contain the lower triangular part of the symmetric matrix 00091 *> packed sequentially, column by column, so that AP( 1 ) 00092 *> contains a( 1, 1 ), AP( 2 ) and AP( 3 ) contain a( 2, 1 ) 00093 *> and a( 3, 1 ) respectively, and so on. 00094 *> Unchanged on exit. 00095 *> \endverbatim 00096 *> 00097 *> \param[in] X 00098 *> \verbatim 00099 *> X is COMPLEX array, dimension at least 00100 *> ( 1 + ( N - 1 )*abs( INCX ) ). 00101 *> Before entry, the incremented array X must contain the N- 00102 *> element vector x. 00103 *> Unchanged on exit. 00104 *> \endverbatim 00105 *> 00106 *> \param[in] INCX 00107 *> \verbatim 00108 *> INCX is INTEGER 00109 *> On entry, INCX specifies the increment for the elements of 00110 *> X. INCX must not be zero. 00111 *> Unchanged on exit. 00112 *> \endverbatim 00113 *> 00114 *> \param[in] BETA 00115 *> \verbatim 00116 *> BETA is COMPLEX 00117 *> On entry, BETA specifies the scalar beta. When BETA is 00118 *> supplied as zero then Y need not be set on input. 00119 *> Unchanged on exit. 00120 *> \endverbatim 00121 *> 00122 *> \param[in,out] Y 00123 *> \verbatim 00124 *> Y is COMPLEX array, dimension at least 00125 *> ( 1 + ( N - 1 )*abs( INCY ) ). 00126 *> Before entry, the incremented array Y must contain the n 00127 *> element vector y. On exit, Y is overwritten by the updated 00128 *> vector y. 00129 *> \endverbatim 00130 *> 00131 *> \param[in] INCY 00132 *> \verbatim 00133 *> INCY is INTEGER 00134 *> On entry, INCY specifies the increment for the elements of 00135 *> Y. INCY must not be zero. 00136 *> Unchanged on exit. 00137 *> \endverbatim 00138 * 00139 * Authors: 00140 * ======== 00141 * 00142 *> \author Univ. of Tennessee 00143 *> \author Univ. of California Berkeley 00144 *> \author Univ. of Colorado Denver 00145 *> \author NAG Ltd. 00146 * 00147 *> \date November 2011 00148 * 00149 *> \ingroup complexOTHERauxiliary 00150 * 00151 * ===================================================================== 00152 SUBROUTINE CSPMV( UPLO, N, ALPHA, AP, X, INCX, BETA, Y, INCY ) 00153 * 00154 * -- LAPACK auxiliary routine (version 3.4.0) -- 00155 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00156 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00157 * November 2011 00158 * 00159 * .. Scalar Arguments .. 00160 CHARACTER UPLO 00161 INTEGER INCX, INCY, N 00162 COMPLEX ALPHA, BETA 00163 * .. 00164 * .. Array Arguments .. 00165 COMPLEX AP( * ), X( * ), Y( * ) 00166 * .. 00167 * 00168 * ===================================================================== 00169 * 00170 * .. Parameters .. 00171 COMPLEX ONE 00172 PARAMETER ( ONE = ( 1.0E+0, 0.0E+0 ) ) 00173 COMPLEX ZERO 00174 PARAMETER ( ZERO = ( 0.0E+0, 0.0E+0 ) ) 00175 * .. 00176 * .. Local Scalars .. 00177 INTEGER I, INFO, IX, IY, J, JX, JY, K, KK, KX, KY 00178 COMPLEX TEMP1, TEMP2 00179 * .. 00180 * .. External Functions .. 00181 LOGICAL LSAME 00182 EXTERNAL LSAME 00183 * .. 00184 * .. External Subroutines .. 00185 EXTERNAL XERBLA 00186 * .. 00187 * .. Executable Statements .. 00188 * 00189 * Test the input parameters. 00190 * 00191 INFO = 0 00192 IF( .NOT.LSAME( UPLO, 'U' ) .AND. .NOT.LSAME( UPLO, 'L' ) ) THEN 00193 INFO = 1 00194 ELSE IF( N.LT.0 ) THEN 00195 INFO = 2 00196 ELSE IF( INCX.EQ.0 ) THEN 00197 INFO = 6 00198 ELSE IF( INCY.EQ.0 ) THEN 00199 INFO = 9 00200 END IF 00201 IF( INFO.NE.0 ) THEN 00202 CALL XERBLA( 'CSPMV ', INFO ) 00203 RETURN 00204 END IF 00205 * 00206 * Quick return if possible. 00207 * 00208 IF( ( N.EQ.0 ) .OR. ( ( ALPHA.EQ.ZERO ) .AND. ( BETA.EQ.ONE ) ) ) 00209 $ RETURN 00210 * 00211 * Set up the start points in X and Y. 00212 * 00213 IF( INCX.GT.0 ) THEN 00214 KX = 1 00215 ELSE 00216 KX = 1 - ( N-1 )*INCX 00217 END IF 00218 IF( INCY.GT.0 ) THEN 00219 KY = 1 00220 ELSE 00221 KY = 1 - ( N-1 )*INCY 00222 END IF 00223 * 00224 * Start the operations. In this version the elements of the array AP 00225 * are accessed sequentially with one pass through AP. 00226 * 00227 * First form y := beta*y. 00228 * 00229 IF( BETA.NE.ONE ) THEN 00230 IF( INCY.EQ.1 ) THEN 00231 IF( BETA.EQ.ZERO ) THEN 00232 DO 10 I = 1, N 00233 Y( I ) = ZERO 00234 10 CONTINUE 00235 ELSE 00236 DO 20 I = 1, N 00237 Y( I ) = BETA*Y( I ) 00238 20 CONTINUE 00239 END IF 00240 ELSE 00241 IY = KY 00242 IF( BETA.EQ.ZERO ) THEN 00243 DO 30 I = 1, N 00244 Y( IY ) = ZERO 00245 IY = IY + INCY 00246 30 CONTINUE 00247 ELSE 00248 DO 40 I = 1, N 00249 Y( IY ) = BETA*Y( IY ) 00250 IY = IY + INCY 00251 40 CONTINUE 00252 END IF 00253 END IF 00254 END IF 00255 IF( ALPHA.EQ.ZERO ) 00256 $ RETURN 00257 KK = 1 00258 IF( LSAME( UPLO, 'U' ) ) THEN 00259 * 00260 * Form y when AP contains the upper triangle. 00261 * 00262 IF( ( INCX.EQ.1 ) .AND. ( INCY.EQ.1 ) ) THEN 00263 DO 60 J = 1, N 00264 TEMP1 = ALPHA*X( J ) 00265 TEMP2 = ZERO 00266 K = KK 00267 DO 50 I = 1, J - 1 00268 Y( I ) = Y( I ) + TEMP1*AP( K ) 00269 TEMP2 = TEMP2 + AP( K )*X( I ) 00270 K = K + 1 00271 50 CONTINUE 00272 Y( J ) = Y( J ) + TEMP1*AP( KK+J-1 ) + ALPHA*TEMP2 00273 KK = KK + J 00274 60 CONTINUE 00275 ELSE 00276 JX = KX 00277 JY = KY 00278 DO 80 J = 1, N 00279 TEMP1 = ALPHA*X( JX ) 00280 TEMP2 = ZERO 00281 IX = KX 00282 IY = KY 00283 DO 70 K = KK, KK + J - 2 00284 Y( IY ) = Y( IY ) + TEMP1*AP( K ) 00285 TEMP2 = TEMP2 + AP( K )*X( IX ) 00286 IX = IX + INCX 00287 IY = IY + INCY 00288 70 CONTINUE 00289 Y( JY ) = Y( JY ) + TEMP1*AP( KK+J-1 ) + ALPHA*TEMP2 00290 JX = JX + INCX 00291 JY = JY + INCY 00292 KK = KK + J 00293 80 CONTINUE 00294 END IF 00295 ELSE 00296 * 00297 * Form y when AP contains the lower triangle. 00298 * 00299 IF( ( INCX.EQ.1 ) .AND. ( INCY.EQ.1 ) ) THEN 00300 DO 100 J = 1, N 00301 TEMP1 = ALPHA*X( J ) 00302 TEMP2 = ZERO 00303 Y( J ) = Y( J ) + TEMP1*AP( KK ) 00304 K = KK + 1 00305 DO 90 I = J + 1, N 00306 Y( I ) = Y( I ) + TEMP1*AP( K ) 00307 TEMP2 = TEMP2 + AP( K )*X( I ) 00308 K = K + 1 00309 90 CONTINUE 00310 Y( J ) = Y( J ) + ALPHA*TEMP2 00311 KK = KK + ( N-J+1 ) 00312 100 CONTINUE 00313 ELSE 00314 JX = KX 00315 JY = KY 00316 DO 120 J = 1, N 00317 TEMP1 = ALPHA*X( JX ) 00318 TEMP2 = ZERO 00319 Y( JY ) = Y( JY ) + TEMP1*AP( KK ) 00320 IX = JX 00321 IY = JY 00322 DO 110 K = KK + 1, KK + N - J 00323 IX = IX + INCX 00324 IY = IY + INCY 00325 Y( IY ) = Y( IY ) + TEMP1*AP( K ) 00326 TEMP2 = TEMP2 + AP( K )*X( IX ) 00327 110 CONTINUE 00328 Y( JY ) = Y( JY ) + ALPHA*TEMP2 00329 JX = JX + INCX 00330 JY = JY + INCY 00331 KK = KK + ( N-J+1 ) 00332 120 CONTINUE 00333 END IF 00334 END IF 00335 * 00336 RETURN 00337 * 00338 * End of CSPMV 00339 * 00340 END