Statistiques
| Révision :

root / src / blas / dsdot.f @ 4

Historique | Voir | Annoter | Télécharger (2,6 ko)

1 1 pfleura2
      DOUBLE PRECISION FUNCTION DSDOT(N,SX,INCX,SY,INCY)
2 1 pfleura2
*     .. Scalar Arguments ..
3 1 pfleura2
      INTEGER INCX,INCY,N
4 1 pfleura2
*     ..
5 1 pfleura2
*     .. Array Arguments ..
6 1 pfleura2
      REAL SX(*),SY(*)
7 1 pfleura2
*     ..
8 1 pfleura2
*
9 1 pfleura2
*  AUTHORS
10 1 pfleura2
*  =======
11 1 pfleura2
*  Lawson, C. L., (JPL), Hanson, R. J., (SNLA),
12 1 pfleura2
*  Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
13 1 pfleura2
*
14 1 pfleura2
*  Purpose
15 1 pfleura2
*  =======
16 1 pfleura2
*  Compute the inner product of two vectors with extended
17 1 pfleura2
*  precision accumulation and result.
18 1 pfleura2
*
19 1 pfleura2
*  Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
20 1 pfleura2
*  DSDOT = sum for I = 0 to N-1 of  SX(LX+I*INCX) * SY(LY+I*INCY),
21 1 pfleura2
*  where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
22 1 pfleura2
*  defined in a similar way using INCY.
23 1 pfleura2
*
24 1 pfleura2
*  Arguments
25 1 pfleura2
*  =========
26 1 pfleura2
*
27 1 pfleura2
*  N      (input) INTEGER
28 1 pfleura2
*         number of elements in input vector(s)
29 1 pfleura2
*
30 1 pfleura2
*  SX     (input) REAL array, dimension(N)
31 1 pfleura2
*         single precision vector with N elements
32 1 pfleura2
*
33 1 pfleura2
*  INCX   (input) INTEGER
34 1 pfleura2
*          storage spacing between elements of SX
35 1 pfleura2
*
36 1 pfleura2
*  SY     (input) REAL array, dimension(N)
37 1 pfleura2
*         single precision vector with N elements
38 1 pfleura2
*
39 1 pfleura2
*  INCY   (input) INTEGER
40 1 pfleura2
*         storage spacing between elements of SY
41 1 pfleura2
*
42 1 pfleura2
*  DSDOT  (output) DOUBLE PRECISION
43 1 pfleura2
*         DSDOT  double precision dot product (zero if N.LE.0)
44 1 pfleura2
*
45 1 pfleura2
*  REFERENCES
46 1 pfleura2
*  ==========
47 1 pfleura2
*
48 1 pfleura2
*  C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
49 1 pfleura2
*  Krogh, Basic linear algebra subprograms for Fortran
50 1 pfleura2
*  usage, Algorithm No. 539, Transactions on Mathematical
51 1 pfleura2
*  Software 5, 3 (September 1979), pp. 308-323.
52 1 pfleura2
*
53 1 pfleura2
*  REVISION HISTORY  (YYMMDD)
54 1 pfleura2
*  ==========================
55 1 pfleura2
*
56 1 pfleura2
*  791001  DATE WRITTEN
57 1 pfleura2
*  890831  Modified array declarations.  (WRB)
58 1 pfleura2
*  890831  REVISION DATE from Version 3.2
59 1 pfleura2
*  891214  Prologue converted to Version 4.0 format.  (BAB)
60 1 pfleura2
*  920310  Corrected definition of LX in DESCRIPTION.  (WRB)
61 1 pfleura2
*  920501  Reformatted the REFERENCES section.  (WRB)
62 1 pfleura2
*  070118  Reformat to LAPACK style (JL)
63 1 pfleura2
*
64 1 pfleura2
*  =====================================================================
65 1 pfleura2
*
66 1 pfleura2
*     .. Local Scalars ..
67 1 pfleura2
      INTEGER I,KX,KY,NS
68 1 pfleura2
*     ..
69 1 pfleura2
*     .. Intrinsic Functions ..
70 1 pfleura2
      INTRINSIC DBLE
71 1 pfleura2
*     ..
72 1 pfleura2
      DSDOT = 0.0D0
73 1 pfleura2
      IF (N.LE.0) RETURN
74 1 pfleura2
      IF (INCX.EQ.INCY .AND. INCX.GT.0) GO TO 20
75 1 pfleura2
*
76 1 pfleura2
*     Code for unequal or nonpositive increments.
77 1 pfleura2
*
78 1 pfleura2
      KX = 1
79 1 pfleura2
      KY = 1
80 1 pfleura2
      IF (INCX.LT.0) KX = 1 + (1-N)*INCX
81 1 pfleura2
      IF (INCY.LT.0) KY = 1 + (1-N)*INCY
82 1 pfleura2
      DO 10 I = 1,N
83 1 pfleura2
          DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
84 1 pfleura2
          KX = KX + INCX
85 1 pfleura2
          KY = KY + INCY
86 1 pfleura2
   10 CONTINUE
87 1 pfleura2
      RETURN
88 1 pfleura2
*
89 1 pfleura2
*     Code for equal, positive, non-unit increments.
90 1 pfleura2
*
91 1 pfleura2
   20 NS = N*INCX
92 1 pfleura2
      DO 30 I = 1,NS,INCX
93 1 pfleura2
          DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
94 1 pfleura2
   30 CONTINUE
95 1 pfleura2
      RETURN
96 1 pfleura2
      END