LAPACK  3.9.0
LAPACK: Linear Algebra PACKage

◆ sdot()

real function sdot ( integer  N,
real, dimension(*)  SX,
integer  INCX,
real, dimension(*)  SY,
integer  INCY 
)

SDOT

Purpose:
    SDOT forms the dot product of two vectors.
    uses unrolled loops for increments equal to one.
Parameters
[in]N
          N is INTEGER
         number of elements in input vector(s)
[in]SX
          SX is REAL array, dimension ( 1 + ( N - 1 )*abs( INCX ) )
[in]INCX
          INCX is INTEGER
         storage spacing between elements of SX
[in]SY
          SY is REAL array, dimension ( 1 + ( N - 1 )*abs( INCY ) )
[in]INCY
          INCY is INTEGER
         storage spacing between elements of SY
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2017
Further Details:
     jack dongarra, linpack, 3/11/78.
     modified 12/3/93, array(1) declarations changed to array(*)

Definition at line 84 of file sdot.f.

84 *
85 * -- Reference BLAS level1 routine (version 3.8.0) --
86 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
87 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
88 * November 2017
89 *
90 * .. Scalar Arguments ..
91  INTEGER INCX,INCY,N
92 * ..
93 * .. Array Arguments ..
94  REAL SX(*),SY(*)
95 * ..
96 *
97 * =====================================================================
98 *
99 * .. Local Scalars ..
100  REAL STEMP
101  INTEGER I,IX,IY,M,MP1
102 * ..
103 * .. Intrinsic Functions ..
104  INTRINSIC mod
105 * ..
106  stemp = 0.0e0
107  sdot = 0.0e0
108  IF (n.LE.0) RETURN
109  IF (incx.EQ.1 .AND. incy.EQ.1) THEN
110 *
111 * code for both increments equal to 1
112 *
113 *
114 * clean-up loop
115 *
116  m = mod(n,5)
117  IF (m.NE.0) THEN
118  DO i = 1,m
119  stemp = stemp + sx(i)*sy(i)
120  END DO
121  IF (n.LT.5) THEN
122  sdot=stemp
123  RETURN
124  END IF
125  END IF
126  mp1 = m + 1
127  DO i = mp1,n,5
128  stemp = stemp + sx(i)*sy(i) + sx(i+1)*sy(i+1) +
129  $ sx(i+2)*sy(i+2) + sx(i+3)*sy(i+3) + sx(i+4)*sy(i+4)
130  END DO
131  ELSE
132 *
133 * code for unequal increments or equal increments
134 * not equal to 1
135 *
136  ix = 1
137  iy = 1
138  IF (incx.LT.0) ix = (-n+1)*incx + 1
139  IF (incy.LT.0) iy = (-n+1)*incy + 1
140  DO i = 1,n
141  stemp = stemp + sx(ix)*sy(iy)
142  ix = ix + incx
143  iy = iy + incy
144  END DO
145  END IF
146  sdot = stemp
147  RETURN
Here is the caller graph for this function:
sdot
real function sdot(N, SX, INCX, SY, INCY)
SDOT
Definition: sdot.f:84