Télécharger dsyr2.eso

Retour à la liste

Numérotation des lignes :

dsyr2
  1. C DSYR2 SOURCE BP208322 22/09/16 21:15:07 11454
  2. *> \brief \b DSYR2
  3. *
  4. * =========== DOCUMENTATION ===========
  5. *
  6. * Online html documentation available at
  7. * http://www.netlib.org/lapack/explore-html/
  8. *
  9. * Definition:
  10. * ===========
  11. *
  12. * SUBROUTINE DSYR2(UPLO,N,ALPHA,X,INCX,Y,INCY,A,LDA)
  13. *
  14. * .. Scalar Arguments ..
  15. * REAL*8 ALPHA
  16. * INTEGER INCX,INCY,LDA,N
  17. * CHARACTER UPLO
  18. * ..
  19. * .. Array Arguments ..
  20. * REAL*8 A(LDA,*),X(*),Y(*)
  21. * ..
  22. *
  23. *
  24. *> \par Purpose:
  25. * =============
  26. *>
  27. *> \verbatim
  28. *>
  29. *> DSYR2 performs the symmetric rank 2 operation
  30. *>
  31. *> A := alpha*x*y**T + alpha*y*x**T + A,
  32. *>
  33. *> where alpha is a scalar, x and y are n element vectors and A is an n
  34. *> by n symmetric matrix.
  35. *> \endverbatim
  36. *
  37. * Arguments:
  38. * ==========
  39. *
  40. *> \param[in] UPLO
  41. *> \verbatim
  42. *> UPLO is CHARACTER*1
  43. *> On entry, UPLO specifies whether the upper or lower
  44. *> triangular part of the array A is to be referenced as
  45. *> follows:
  46. *>
  47. *> UPLO = 'U' or 'u' Only the upper triangular part of A
  48. *> is to be referenced.
  49. *>
  50. *> UPLO = 'L' or 'l' Only the lower triangular part of A
  51. *> is to be referenced.
  52. *> \endverbatim
  53. *>
  54. *> \param[in] N
  55. *> \verbatim
  56. *> N is INTEGER
  57. *> On entry, N specifies the order of the matrix A.
  58. *> N must be at least zero.
  59. *> \endverbatim
  60. *>
  61. *> \param[in] ALPHA
  62. *> \verbatim
  63. *> ALPHA is REAL*8.
  64. *> On entry, ALPHA specifies the scalar alpha.
  65. *> \endverbatim
  66. *>
  67. *> \param[in] X
  68. *> \verbatim
  69. *> X is REAL*8 array, dimension at least
  70. *> ( 1 + ( n - 1 )*abs( INCX ) ).
  71. *> Before entry, the incremented array X must contain the n
  72. *> element vector x.
  73. *> \endverbatim
  74. *>
  75. *> \param[in] INCX
  76. *> \verbatim
  77. *> INCX is INTEGER
  78. *> On entry, INCX specifies the increment for the elements of
  79. *> X. INCX must not be zero.
  80. *> \endverbatim
  81. *>
  82. *> \param[in] Y
  83. *> \verbatim
  84. *> Y is REAL*8 array, dimension at least
  85. *> ( 1 + ( n - 1 )*abs( INCY ) ).
  86. *> Before entry, the incremented array Y must contain the n
  87. *> element vector y.
  88. *> \endverbatim
  89. *>
  90. *> \param[in] INCY
  91. *> \verbatim
  92. *> INCY is INTEGER
  93. *> On entry, INCY specifies the increment for the elements of
  94. *> Y. INCY must not be zero.
  95. *> \endverbatim
  96. *>
  97. *> \param[in,out] A
  98. *> \verbatim
  99. *> A is REAL*8 array, dimension ( LDA, N )
  100. *> Before entry with UPLO = 'U' or 'u', the leading n by n
  101. *> upper triangular part of the array A must contain the upper
  102. *> triangular part of the symmetric matrix and the strictly
  103. *> lower triangular part of A is not referenced. On exit, the
  104. *> upper triangular part of the array A is overwritten by the
  105. *> upper triangular part of the updated matrix.
  106. *> Before entry with UPLO = 'L' or 'l', the leading n by n
  107. *> lower triangular part of the array A must contain the lower
  108. *> triangular part of the symmetric matrix and the strictly
  109. *> upper triangular part of A is not referenced. On exit, the
  110. *> lower triangular part of the array A is overwritten by the
  111. *> lower triangular part of the updated matrix.
  112. *> \endverbatim
  113. *>
  114. *> \param[in] LDA
  115. *> \verbatim
  116. *> LDA is INTEGER
  117. *> On entry, LDA specifies the first dimension of A as declared
  118. *> in the calling (sub) program. LDA must be at least
  119. *> max( 1, n ).
  120. *> \endverbatim
  121. *
  122. * Authors:
  123. * ========
  124. *
  125. *> \author Univ. of Tennessee
  126. *> \author Univ. of California Berkeley
  127. *> \author Univ. of Colorado Denver
  128. *> \author NAG Ltd.
  129. *
  130. *> \ingroup double_blas_level2
  131. *
  132. *> \par Further Details:
  133. * =====================
  134. *>
  135. *> \verbatim
  136. *>
  137. *> Level 2 Blas routine.
  138. *>
  139. *> -- Written on 22-October-1986.
  140. *> Jack Dongarra, Argonne National Lab.
  141. *> Jeremy Du Croz, Nag Central Office.
  142. *> Sven Hammarling, Nag Central Office.
  143. *> Richard Hanson, Sandia National Labs.
  144. *> \endverbatim
  145. *>
  146. * =====================================================================
  147. SUBROUTINE DSYR2(UPLO,N,ALPHA,X,INCX,Y,INCY,A,LDA)
  148. *
  149. * -- Reference BLAS level2 routine --
  150. * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
  151. * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
  152. *
  153. * .. Scalar Arguments ..
  154. REAL*8 ALPHA
  155. INTEGER INCX,INCY,LDA,N
  156. CHARACTER UPLO
  157. * ..
  158. * .. Array Arguments ..
  159. REAL*8 A(LDA,*),X(*),Y(*)
  160. * ..
  161. *
  162. * =====================================================================
  163. *
  164. * .. Parameters ..
  165. REAL*8 ZERO
  166. PARAMETER (ZERO=0.0D+0)
  167. * ..
  168. * .. Local Scalars ..
  169. REAL*8 TEMP1,TEMP2
  170. INTEGER I,INFO,IX,IY,J,JX,JY,KX,KY
  171. * ..
  172. * .. External Functions ..
  173. LOGICAL LSAME
  174. EXTERNAL LSAME
  175. * ..
  176. * .. External Subroutines ..
  177. EXTERNAL XERBLA
  178. * ..
  179. * .. Intrinsic Functions ..
  180. * INTRINSIC MAX
  181. * ..
  182. *
  183. * Test the input parameters.
  184. *
  185. INFO = 0
  186. IF (.NOT.LSAME(UPLO,'U') .AND. .NOT.LSAME(UPLO,'L')) THEN
  187. INFO = 1
  188. ELSE IF (N.LT.0) THEN
  189. INFO = 2
  190. ELSE IF (INCX.EQ.0) THEN
  191. INFO = 5
  192. ELSE IF (INCY.EQ.0) THEN
  193. INFO = 7
  194. ELSE IF (LDA.LT.MAX(1,N)) THEN
  195. INFO = 9
  196. END IF
  197. IF (INFO.NE.0) THEN
  198. CALL XERBLA('DSYR2 ',INFO)
  199. RETURN
  200. END IF
  201. *
  202. * Quick return if possible.
  203. *
  204. IF ((N.EQ.0) .OR. (ALPHA.EQ.ZERO)) RETURN
  205. *
  206. * Set up the start points in X and Y if the increments are not both
  207. * unity.
  208. *
  209. IF ((INCX.NE.1) .OR. (INCY.NE.1)) THEN
  210. IF (INCX.GT.0) THEN
  211. KX = 1
  212. ELSE
  213. KX = 1 - (N-1)*INCX
  214. END IF
  215. IF (INCY.GT.0) THEN
  216. KY = 1
  217. ELSE
  218. KY = 1 - (N-1)*INCY
  219. END IF
  220. JX = KX
  221. JY = KY
  222. END IF
  223. *
  224. * Start the operations. In this version the elements of A are
  225. * accessed sequentially with one pass through the triangular part
  226. * of A.
  227. *
  228. IF (LSAME(UPLO,'U')) THEN
  229. *
  230. * Form A when A is stored in the upper triangle.
  231. *
  232. IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
  233. DO 20 J = 1,N
  234. IF ((X(J).NE.ZERO) .OR. (Y(J).NE.ZERO)) THEN
  235. TEMP1 = ALPHA*Y(J)
  236. TEMP2 = ALPHA*X(J)
  237. DO 10 I = 1,J
  238. A(I,J) = A(I,J) + X(I)*TEMP1 + Y(I)*TEMP2
  239. 10 CONTINUE
  240. END IF
  241. 20 CONTINUE
  242. ELSE
  243. DO 40 J = 1,N
  244. IF ((X(JX).NE.ZERO) .OR. (Y(JY).NE.ZERO)) THEN
  245. TEMP1 = ALPHA*Y(JY)
  246. TEMP2 = ALPHA*X(JX)
  247. IX = KX
  248. IY = KY
  249. DO 30 I = 1,J
  250. A(I,J) = A(I,J) + X(IX)*TEMP1 + Y(IY)*TEMP2
  251. IX = IX + INCX
  252. IY = IY + INCY
  253. 30 CONTINUE
  254. END IF
  255. JX = JX + INCX
  256. JY = JY + INCY
  257. 40 CONTINUE
  258. END IF
  259. ELSE
  260. *
  261. * Form A when A is stored in the lower triangle.
  262. *
  263. IF ((INCX.EQ.1) .AND. (INCY.EQ.1)) THEN
  264. DO 60 J = 1,N
  265. IF ((X(J).NE.ZERO) .OR. (Y(J).NE.ZERO)) THEN
  266. TEMP1 = ALPHA*Y(J)
  267. TEMP2 = ALPHA*X(J)
  268. DO 50 I = J,N
  269. A(I,J) = A(I,J) + X(I)*TEMP1 + Y(I)*TEMP2
  270. 50 CONTINUE
  271. END IF
  272. 60 CONTINUE
  273. ELSE
  274. DO 80 J = 1,N
  275. IF ((X(JX).NE.ZERO) .OR. (Y(JY).NE.ZERO)) THEN
  276. TEMP1 = ALPHA*Y(JY)
  277. TEMP2 = ALPHA*X(JX)
  278. IX = JX
  279. IY = JY
  280. DO 70 I = J,N
  281. A(I,J) = A(I,J) + X(IX)*TEMP1 + Y(IY)*TEMP2
  282. IX = IX + INCX
  283. IY = IY + INCY
  284. 70 CONTINUE
  285. END IF
  286. JX = JX + INCX
  287. JY = JY + INCY
  288. 80 CONTINUE
  289. END IF
  290. END IF
  291. *
  292. RETURN
  293. *
  294. * End of DSYR2
  295. *
  296. END
  297.  
  298.  

© Cast3M 2003 - Tous droits réservés.
Mentions légales