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