dsdi.f 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. *DECK DSDI
  2. SUBROUTINE DSDI (N, B, X, NELT, IA, JA, A, ISYM, RWORK, IWORK)
  3. C***BEGIN PROLOGUE DSDI
  4. C***PURPOSE Diagonal Matrix Vector Multiply.
  5. C Routine to calculate the product X = DIAG*B, where DIAG
  6. C is a diagonal matrix.
  7. C***LIBRARY SLATEC (SLAP)
  8. C***CATEGORY D1B4
  9. C***TYPE DOUBLE PRECISION (SSDI-S, DSDI-D)
  10. C***KEYWORDS ITERATIVE PRECONDITION, LINEAR SYSTEM SOLVE, SLAP, SPARSE
  11. C***AUTHOR Greenbaum, Anne, (Courant Institute)
  12. C Seager, Mark K., (LLNL)
  13. C Lawrence Livermore National Laboratory
  14. C PO BOX 808, L-60
  15. C Livermore, CA 94550 (510) 423-3141
  16. C seager@llnl.gov
  17. C***DESCRIPTION
  18. C
  19. C *Usage:
  20. C INTEGER N, NELT, IA(NELT), JA(NELT), ISYM, IWORK(10)
  21. C DOUBLE PRECISION B(N), X(N), A(NELT), RWORK(USER DEFINED)
  22. C
  23. C CALL DSDI (N, B, X, NELT, IA, JA, A, ISYM, RWORK, IWORK)
  24. C
  25. C *Arguments:
  26. C N :IN Integer
  27. C Order of the Matrix.
  28. C B :IN Double Precision B(N).
  29. C Vector to multiply the diagonal by.
  30. C X :OUT Double Precision X(N).
  31. C Result of DIAG*B.
  32. C NELT :DUMMY Integer.
  33. C IA :DUMMY Integer IA(NELT).
  34. C JA :DUMMY Integer JA(NELT).
  35. C A :DUMMY Double Precision A(NELT).
  36. C ISYM :DUMMY Integer.
  37. C These are for compatibility with SLAP MSOLVE calling sequence.
  38. C RWORK :IN Double Precision RWORK(USER DEFINED).
  39. C Work array holding the diagonal of some matrix to scale
  40. C B by. This array must be set by the user or by a call
  41. C to the SLAP routine DSDS or DSD2S. The length of RWORK
  42. C must be >= IWORK(4)+N.
  43. C IWORK :IN Integer IWORK(10).
  44. C IWORK(4) holds the offset into RWORK for the diagonal matrix
  45. C to scale B by. This is usually set up by the SLAP pre-
  46. C conditioner setup routines DSDS or DSD2S.
  47. C
  48. C *Description:
  49. C This routine is supplied with the SLAP package to perform
  50. C the MSOLVE operation for iterative drivers that require
  51. C diagonal Scaling (e.g., DSDCG, DSDBCG). It conforms
  52. C to the SLAP MSOLVE CALLING CONVENTION and hence does not
  53. C require an interface routine as do some of the other pre-
  54. C conditioners supplied with SLAP.
  55. C
  56. C***SEE ALSO DSDS, DSD2S
  57. C***REFERENCES (NONE)
  58. C***ROUTINES CALLED (NONE)
  59. C***REVISION HISTORY (YYMMDD)
  60. C 871119 DATE WRITTEN
  61. C 881213 Previous REVISION DATE
  62. C 890915 Made changes requested at July 1989 CML Meeting. (MKS)
  63. C 890922 Numerous changes to prologue to make closer to SLATEC
  64. C standard. (FNF)
  65. C 890929 Numerous changes to reduce SP/DP differences. (FNF)
  66. C 910411 Prologue converted to Version 4.0 format. (BAB)
  67. C 920511 Added complete declaration section. (WRB)
  68. C 930701 Updated CATEGORY section. (FNF, WRB)
  69. C***END PROLOGUE DSDI
  70. C .. Scalar Arguments ..
  71. INTEGER ISYM, N, NELT
  72. C .. Array Arguments ..
  73. DOUBLE PRECISION A(NELT), B(N), RWORK(*), X(N)
  74. INTEGER IA(NELT), IWORK(10), JA(NELT)
  75. C .. Local Scalars ..
  76. INTEGER I, LOCD
  77. C***FIRST EXECUTABLE STATEMENT DSDI
  78. C
  79. C Determine where the inverse of the diagonal
  80. C is in the work array and then scale by it.
  81. C
  82. LOCD = IWORK(4) - 1
  83. DO 10 I = 1, N
  84. X(I) = RWORK(LOCD+I)*B(I)
  85. 10 CONTINUE
  86. RETURN
  87. C------------- LAST LINE OF DSDI FOLLOWS ----------------------------
  88. END