mnddot.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: mnddot.cxx 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 /* ddot.f -- translated by f2c (version 20010320).
00011    You must link the resulting object file with the libraries:
00012         -lf2c -lm   (in that order)
00013 */
00014 
00015 namespace ROOT {
00016 
00017    namespace Minuit2 {
00018 
00019 
00020 double mnddot(unsigned int n, const double* dx, int incx, const double* dy, 
00021               int incy) {
00022    /* System generated locals */
00023    int i__1;
00024    double ret_val;
00025    
00026    /* Local variables */
00027    int i__, m;
00028    double dtemp;
00029    int ix, iy, mp1;
00030    
00031    
00032    /*     forms the dot product of two vectors. */
00033    /*     uses unrolled loops for increments equal to one. */
00034    /*     jack dongarra, linpack, 3/11/78. */
00035    /*     modified 12/3/93, array(1) declarations changed to array(*) */
00036    
00037    
00038    /* Parameter adjustments */
00039    --dy;
00040    --dx;
00041    
00042    /* Function Body */
00043    ret_val = 0.;
00044    dtemp = 0.;
00045    if (n <= 0) {
00046       return ret_val;
00047    }
00048    if (incx == 1 && incy == 1) {
00049       goto L20;
00050    }
00051    
00052    /*        code for unequal increments or equal increments */
00053    /*          not equal to 1 */
00054    
00055    ix = 1;
00056    iy = 1;
00057    if (incx < 0) {
00058       ix = (-static_cast<int>(n) + 1) * incx + 1;
00059    }
00060    if (incy < 0) {
00061       iy = (-static_cast<int>(n) + 1) * incy + 1;
00062    }
00063    i__1 = n;
00064    for (i__ = 1; i__ <= i__1; ++i__) {
00065       dtemp += dx[ix] * dy[iy];
00066       ix += incx;
00067       iy += incy;
00068       /* L10: */
00069    }
00070    ret_val = dtemp;
00071    return ret_val;
00072    
00073    /*        code for both increments equal to 1 */
00074    
00075    
00076    /*        clean-up loop */
00077    
00078 L20:
00079       m = n % 5;
00080    if (m == 0) {
00081       goto L40;
00082    }
00083    i__1 = m;
00084    for (i__ = 1; i__ <= i__1; ++i__) {
00085       dtemp += dx[i__] * dy[i__];
00086       /* L30: */
00087    }
00088    if (n < 5) {
00089       goto L60;
00090    }
00091 L40:
00092       mp1 = m + 1;
00093    i__1 = n;
00094    for (i__ = mp1; i__ <= i__1; i__ += 5) {
00095       dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + dx[
00096          i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + dx[i__ + 
00097             4] * dy[i__ + 4];
00098       /* L50: */
00099    }
00100 L60:
00101       ret_val = dtemp;
00102    return ret_val;
00103 } /* ddot_ */
00104 
00105 
00106    }  // namespace Minuit2
00107 
00108 }  // namespace ROOT

Generated on Tue Jul 5 14:37:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1