dqdoti.f 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. *DECK DQDOTI
  2. DOUBLE PRECISION FUNCTION DQDOTI (N, DB, QC, DX, INCX, DY, INCY)
  3. C***BEGIN PROLOGUE DQDOTI
  4. C***PURPOSE Compute the inner product of two vectors with extended
  5. C precision accumulation and result.
  6. C***LIBRARY SLATEC
  7. C***CATEGORY D1A4
  8. C***TYPE DOUBLE PRECISION (DQDOTI-D)
  9. C***KEYWORDS DOT PRODUCT, INNER PRODUCT
  10. C***AUTHOR Lawson, C. L., (JPL)
  11. C Hanson, R. J., (SNLA)
  12. C Kincaid, D. R., (U. of Texas)
  13. C Krogh, F. T., (JPL)
  14. C***DESCRIPTION
  15. C
  16. C B L A S Subprogram
  17. C Description of parameters
  18. C
  19. C --Input--
  20. C N number of elements in input vector(s)
  21. C DB double precision scalar to be added to inner product
  22. C QC extended precision scalar to be added
  23. C DX double precision vector with N elements
  24. C INCX storage spacing between elements of DX
  25. C DY double precision vector with N elements
  26. C INCY storage spacing between elements of DY
  27. C
  28. C --Output--
  29. C DQDOTI double precision result
  30. C QC extended precision result
  31. C
  32. C D.P. dot product with extended precision accumulation (and result)
  33. C QC and DQDOTI are set = DB + sum for I = 0 to N-1 of
  34. C DX(LX+I*INCX) * DY(LY+I*INCY), where QC is an extended
  35. C precision result which can be used as input to DQDOTA,
  36. C and LX = 1 if INCX .GE. 0, else LX = (-INCX)*N, and LY is
  37. C defined in a similar way using INCY. The MP package by
  38. C Richard P. Brent is used for the extended precision arithmetic.
  39. C
  40. C Fred T. Krogh, JPL, 1977, June 1
  41. C
  42. C The common block for the MP package is named MPCOM. If local
  43. C variable I1 is zero, DQDOTI calls MPBLAS to initialize the MP
  44. C package and reset I1 to 1.
  45. C
  46. C The argument QC(*), and the local variables QX and QY are INTEGER
  47. C arrays of size 30. See the comments in the routine MPBLAS for the
  48. C reason for this choice.
  49. C
  50. C***REFERENCES C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
  51. C Krogh, Basic linear algebra subprograms for Fortran
  52. C usage, Algorithm No. 539, Transactions on Mathematical
  53. C Software 5, 3 (September 1979), pp. 308-323.
  54. C***ROUTINES CALLED MPADD, MPBLAS, MPCDM, MPCMD, MPMUL
  55. C***COMMON BLOCKS MPCOM
  56. C***REVISION HISTORY (YYMMDD)
  57. C 791001 DATE WRITTEN
  58. C 890831 Modified array declarations. (WRB)
  59. C 890831 REVISION DATE from Version 3.2
  60. C 891214 Prologue converted to Version 4.0 format. (BAB)
  61. C 920501 Reformatted the REFERENCES section. (WRB)
  62. C 930124 Increased Array sizes for SUN -r8. (RWC)
  63. C***END PROLOGUE DQDOTI
  64. DOUBLE PRECISION DX(*), DY(*), DB
  65. INTEGER QC(30), QX(30), QY(30)
  66. COMMON /MPCOM/ MPB, MPT, MPM, MPLUN, MPMXR, MPR(30)
  67. SAVE I1
  68. DATA I1 / 0 /
  69. C***FIRST EXECUTABLE STATEMENT DQDOTI
  70. IF (I1 .EQ. 0) CALL MPBLAS(I1)
  71. QC(1) = 0
  72. IF (DB .EQ. 0.D0) GO TO 60
  73. CALL MPCDM(DB, QX)
  74. CALL MPADD(QC, QX, QC)
  75. 60 IF (N .EQ. 0) GO TO 80
  76. IX = 1
  77. IY = 1
  78. IF (INCX .LT. 0) IX = (-N + 1) * INCX + 1
  79. IF (INCY .LT. 0) IY = (-N + 1) * INCY + 1
  80. DO 70 I = 1,N
  81. CALL MPCDM(DX(IX), QX)
  82. CALL MPCDM(DY(IY), QY)
  83. CALL MPMUL(QX, QY, QX)
  84. CALL MPADD(QC, QX, QC)
  85. IX = IX + INCX
  86. IY = IY + INCY
  87. 70 CONTINUE
  88. 80 CALL MPCMD(QC, DQDOTI)
  89. RETURN
  90. END