Télécharger dmomv.eso

Retour à la liste

Numérotation des lignes :

dmomv
  1. C DMOMV SOURCE GOUNAND 05/02/16 21:15:19 5029
  2. SUBROUTINE DMOMV ( TRANS, N, ALPHA, NNZ, ROWPTR, COLIND, VAL,
  3. $ X, BETA, Y )
  4. IMPLICIT REAL*8 (A-H,O-Z)
  5. IMPLICIT INTEGER (I-N)
  6. ***********************************************************************
  7. C NOM : DMOMV
  8. C DESCRIPTION :
  9. C DMOMV is a modified (16/2/98), reduced,
  10. C version of DGEMV as defined in BLAS 2.
  11. C
  12. C It performs one of the matrix-vector operations
  13. C
  14. C y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y,
  15. C
  16. C where alpha and beta are scalars, x and y are vectors
  17. C A is an n by n (square) matrix stored in Morse format
  18. C (also known as Compressed Row Storage (CRS)).
  19. C
  20. C LANGAGE : ESOPE
  21. C AUTEUR : Stéphane GOUNAND (CEA/DRN/DMT/SEMT/TTMF)
  22. C mél : gounand@semt2.smts.cea.fr
  23. C REFERENCE (bibtex-like) :
  24. C @BOOK{templates,
  25. C AUTHOR={R.Barrett, M.Berry, T.F.Chan, J.Demmel, J.Donato,
  26. C J.Dongarra, V.Eijkhout, R.Pozo, C.Romine,
  27. C H. Van der Vorst},
  28. C TITLE={Templates for the Solution of Linear Systems :
  29. C Building Blocks for Iterative Methods},
  30. C PUBLISHER={SIAM}, YEAR={1994}, ADDRESS={Philadelphia,PA} }
  31. C -> URL : http://www.netlib.org/templates/Templates.html
  32. C***********************************************************************
  33. C APPELES : -
  34. C***********************************************************************
  35. C ENTREES : TRANS, N, ALPHA,
  36. C NNZ, ROWPTR, COLIND, VAL,
  37. C X, BETA
  38. C ENTREES/SORTIES : Y
  39. C SORTIES : -
  40. C CODE RETOUR (IRET) : -
  41. C TRANS - CHARACTER*1.
  42. C On entry, TRANS specifies the operation to be performed as
  43. C follows:
  44. C TRANS = 'N' or 'n' y := alpha*A*x + beta*y.
  45. C TRANS = 'T' or 't' y := alpha*A'*x + beta*y.
  46. C TRANS = 'C' or 'c' y := alpha*A'*x + beta*y.
  47. C Note : working with TRANS = 'T' might be slower due to storage format
  48. C If speed is more important than memory consumption, storing the
  49. C transpose matrix before calling DMOMV might help
  50. C
  51. C N - INTEGER.
  52. C On entry, N specifies the number of columns and rows
  53. C of the matrix A.
  54. C N must be at least zero.
  55. C
  56. C ALPHA - REAL*8.
  57. C On entry, ALPHA specifies the scalar alpha.
  58. C
  59. C NNZ : nombre de valeurs non nulles de la matrice Morse
  60. C ROWPTR, COLIND, VAL : pointeur de ligne, index de colonne
  61. C et valeurs de la matrice Morse
  62. C
  63. C X - REAL*8 array of DIMENSION N
  64. C
  65. C BETA - REAL*8.
  66. C On entry, BETA specifies the scalar beta. When BETA is
  67. C supplied as zero then Y need not be set on input.
  68. C
  69. C Y - REAL*8 array of DIMENSION N
  70. C Before entry with BETA non-zero, the array Y
  71. C must contain the vector y. On exit, Y is overwritten by the
  72. C updated vector y.
  73. C
  74. C***********************************************************************
  75. C VERSION : v1, 16/02/98, version initiale
  76. C HISTORIQUE : v1, 16/02/98, création
  77. C HISTORIQUE :
  78. C HISTORIQUE :
  79. C***********************************************************************
  80. C Prière de PRENDRE LE TEMPS de compléter les commentaires
  81. C en cas de modification de ce sous-programme afin de faciliter
  82. C la maintenance !
  83. C***********************************************************************
  84. * .. Scalar Arguments ..
  85. REAL*8 ALPHA, BETA
  86. INTEGER N, NNZ
  87. CHARACTER*1 TRANS
  88. * .. Array Arguments ..
  89. * .. Morse Matrix
  90. INTEGER ROWPTR( N+1 )
  91. INTEGER COLIND( NNZ )
  92. REAL*8 VAL( NNZ )
  93. * .. Vectors
  94. REAL*8 X( N ), Y( N )
  95. * ..
  96. * Level 2 Blas routine.
  97. *
  98. * -- Written on 22-October-1986.
  99. * Jack Dongarra, Argonne National Lab.
  100. * Jeremy Du Croz, Nag Central Office.
  101. * Sven Hammarling, Nag Central Office.
  102. * Richard Hanson, Sandia National Labs.
  103. * -- Modified on 16-February-1998
  104. *
  105.  
  106. -INC PPARAM
  107. -INC CCOPTIO
  108. *
  109. * .. Parameters ..
  110. REAL*8 ONE , ZERO
  111. PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
  112. * .. Local Scalars ..
  113. REAL*8 TEMP
  114. INTEGER I, J
  115. * .. External Functions ..
  116. LOGICAL LSAME
  117. EXTERNAL LSAME
  118. * ..
  119. * .. Executable Statements ..
  120. *
  121. * Test the input parameters.
  122. *
  123. IF ( .NOT.LSAME( TRANS, 'N' ).AND.
  124. $ .NOT.LSAME( TRANS, 'T' ).AND.
  125. $ .NOT.LSAME( TRANS, 'C' ) )THEN
  126. GOTO 9999
  127. ELSE IF( N.LE.0 )THEN
  128. GOTO 9998
  129. END IF
  130. *
  131. * Quick return if possible.
  132. *
  133. IF( ( ALPHA.EQ.ZERO ).AND.( BETA.EQ.ONE ) )
  134. $ RETURN
  135. *
  136. * Start the operations. In this version the elements of A are
  137. * accessed sequentially with one pass through A.
  138. *
  139. * First form y := beta*y.
  140. *
  141. IF( BETA.NE.ONE )THEN
  142. IF( BETA.EQ.ZERO )THEN
  143. DO 10, I = 1, N
  144. Y( I ) = ZERO
  145. 10 CONTINUE
  146. ELSE
  147. DO 20, I = 1, N
  148. Y( I ) = BETA*Y( I )
  149. 20 CONTINUE
  150. END IF
  151. END IF
  152. IF( ALPHA.EQ.ZERO )
  153. $ RETURN
  154. IF( LSAME( TRANS, 'N' ) )THEN
  155. *
  156. * Form y := alpha*A*x + y.
  157. *
  158. DO 60, I = 1, N
  159. DO 50, J = ROWPTR( I ), (ROWPTR( I+1 ) - 1)
  160. *!!! IF ( X( COLIND( J )).NE.ZERO ) THEN
  161. Y( I ) = Y( I ) + (ALPHA * VAL( J ) * X( COLIND( J )))
  162. *!!! ENDIF
  163. 50 CONTINUE
  164. 60 CONTINUE
  165. ELSE
  166. *
  167. * Form y := alpha*A'*x + y.
  168. *
  169. DO 100, J = 1, N
  170. IF ( X( J ).NE.ZERO ) THEN
  171. TEMP = ALPHA * X( J )
  172. DO 90, I = ROWPTR( J ), (ROWPTR( J+1 ) - 1)
  173. Y( COLIND( I )) = Y( COLIND( I ))
  174. $ + VAL( I ) * TEMP
  175. 90 CONTINUE
  176. ENDIF
  177. 100 CONTINUE
  178. ENDIF
  179. *
  180. * Normal termination
  181. *
  182. RETURN
  183. *
  184. * Format handling
  185. *
  186. *
  187. * Error handling
  188. *
  189. 9998 CONTINUE
  190. WRITE(IOIMP,*) 'Dimension or increment lower than 1'
  191. WRITE(IOIMP,*) 'transmitted to subroutine dmomv'
  192. WRITE(IOIMP,*) 'nothing done'
  193. RETURN
  194. 9999 CONTINUE
  195. WRITE(IOIMP,*) 'Wrong option for TRANS'
  196. WRITE(IOIMP,*) 'transmitted to subroutine dmomv'
  197. WRITE(IOIMP,*) 'nothing done'
  198. RETURN
  199. *
  200. * End of DMOMV.
  201. *
  202. END
  203.  
  204.  
  205.  

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