LAPACK  3.4.1
LAPACK: Linear Algebra PACKage
dsdot.f
Go to the documentation of this file.
00001 *> \brief \b DSDOT
00002 *
00003 *  =========== DOCUMENTATION ===========
00004 *
00005 * Online html documentation available at 
00006 *            http://www.netlib.org/lapack/explore-html/ 
00007 *
00008 *  Definition:
00009 *  ===========
00010 *
00011 *       DOUBLE PRECISION FUNCTION DSDOT(N,SX,INCX,SY,INCY)
00012 * 
00013 *       .. Scalar Arguments ..
00014 *       INTEGER INCX,INCY,N
00015 *       ..
00016 *       .. Array Arguments ..
00017 *       REAL SX(*),SY(*)
00018 *       ..
00019 *  
00020 *    AUTHORS
00021 *    =======
00022 *    Lawson, C. L., (JPL), Hanson, R. J., (SNLA), 
00023 *    Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
00024 *  
00025 *
00026 *> \par Purpose:
00027 *  =============
00028 *>
00029 *> \verbatim
00030 *>
00031 *> Compute the inner product of two vectors with extended
00032 *> precision accumulation and result.
00033 *>
00034 *> Returns D.P. dot product accumulated in D.P., for S.P. SX and SY
00035 *> DSDOT = sum for I = 0 to N-1 of  SX(LX+I*INCX) * SY(LY+I*INCY),
00036 *> where LX = 1 if INCX .GE. 0, else LX = 1+(1-N)*INCX, and LY is
00037 *> defined in a similar way using INCY.
00038 *> \endverbatim
00039 *
00040 *  Arguments:
00041 *  ==========
00042 *
00043 *> \param[in] N
00044 *> \verbatim
00045 *>          N is INTEGER
00046 *>         number of elements in input vector(s)
00047 *> \endverbatim
00048 *>
00049 *> \param[in] SX
00050 *> \verbatim
00051 *>          SX is REAL array, dimension(N)
00052 *>         single precision vector with N elements
00053 *> \endverbatim
00054 *>
00055 *> \param[in] INCX
00056 *> \verbatim
00057 *>          INCX is INTEGER
00058 *>          storage spacing between elements of SX
00059 *> \endverbatim
00060 *>
00061 *> \param[in] SY
00062 *> \verbatim
00063 *>          SY is REAL array, dimension(N)
00064 *>         single precision vector with N elements
00065 *> \endverbatim
00066 *>
00067 *> \param[in] INCY
00068 *> \verbatim
00069 *>          INCY is INTEGER
00070 *>         storage spacing between elements of SY
00071 *> \endverbatim
00072 *>
00073 *> \result DSDOT
00074 *> \verbatim
00075 *>          DSDOT is DOUBLE PRECISION
00076 *>         DSDOT  double precision dot product (zero if N.LE.0)
00077 *> \endverbatim
00078 *
00079 *  Authors:
00080 *  ========
00081 *
00082 *> \author Univ. of Tennessee 
00083 *> \author Univ. of California Berkeley 
00084 *> \author Univ. of Colorado Denver 
00085 *> \author NAG Ltd. 
00086 *
00087 *> \date November 2011
00088 *
00089 *> \ingroup double_blas_level1
00090 *
00091 *> \par Further Details:
00092 *  =====================
00093 *>
00094 *> \verbatim
00095 *> \endverbatim
00096 *
00097 *> \par References:
00098 *  ================
00099 *>
00100 *> \verbatim
00101 *>
00102 *>      
00103 *>  C. L. Lawson, R. J. Hanson, D. R. Kincaid and F. T.
00104 *>  Krogh, Basic linear algebra subprograms for Fortran
00105 *>  usage, Algorithm No. 539, Transactions on Mathematical
00106 *>  Software 5, 3 (September 1979), pp. 308-323.
00107 *>
00108 *>  REVISION HISTORY  (YYMMDD)
00109 *>
00110 *>  791001  DATE WRITTEN
00111 *>  890831  Modified array declarations.  (WRB)
00112 *>  890831  REVISION DATE from Version 3.2
00113 *>  891214  Prologue converted to Version 4.0 format.  (BAB)
00114 *>  920310  Corrected definition of LX in DESCRIPTION.  (WRB)
00115 *>  920501  Reformatted the REFERENCES section.  (WRB)
00116 *>  070118  Reformat to LAPACK style (JL)
00117 *> \endverbatim
00118 *>
00119 *  =====================================================================
00120       DOUBLE PRECISION FUNCTION DSDOT(N,SX,INCX,SY,INCY)
00121 *
00122 *  -- Reference BLAS level1 routine (version 3.4.0) --
00123 *  -- Reference BLAS is a software package provided by Univ. of Tennessee,    --
00124 *  -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
00125 *     November 2011
00126 *
00127 *     .. Scalar Arguments ..
00128       INTEGER INCX,INCY,N
00129 *     ..
00130 *     .. Array Arguments ..
00131       REAL SX(*),SY(*)
00132 *     ..
00133 *
00134 *  Authors:
00135 *  ========
00136 *  Lawson, C. L., (JPL), Hanson, R. J., (SNLA), 
00137 *  Kincaid, D. R., (U. of Texas), Krogh, F. T., (JPL)
00138 *
00139 *  =====================================================================
00140 *
00141 *     .. Local Scalars ..
00142       INTEGER I,KX,KY,NS
00143 *     ..
00144 *     .. Intrinsic Functions ..
00145       INTRINSIC DBLE
00146 *     ..
00147       DSDOT = 0.0D0
00148       IF (N.LE.0) RETURN
00149       IF (INCX.EQ.INCY .AND. INCX.GT.0) THEN
00150 *
00151 *     Code for equal, positive, non-unit increments.
00152 *
00153          NS = N*INCX
00154          DO I = 1,NS,INCX
00155             DSDOT = DSDOT + DBLE(SX(I))*DBLE(SY(I))
00156          END DO
00157       ELSE
00158 *
00159 *     Code for unequal or nonpositive increments.
00160 *
00161          KX = 1
00162          KY = 1
00163          IF (INCX.LT.0) KX = 1 + (1-N)*INCX
00164          IF (INCY.LT.0) KY = 1 + (1-N)*INCY
00165          DO I = 1,N
00166             DSDOT = DSDOT + DBLE(SX(KX))*DBLE(SY(KY))
00167             KX = KX + INCX
00168             KY = KY + INCY
00169          END DO
00170       END IF
00171       RETURN
00172       END
 All Files Functions