mndasum.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: mndasum.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 /* dasum.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 #include <math.h>
00016 
00017 namespace ROOT {
00018 
00019    namespace Minuit2 {
00020 
00021 
00022 double mndasum(unsigned int n, const double* dx, int incx) {
00023    /* System generated locals */
00024    int i__1, i__2;
00025    double ret_val, d__1, d__2, d__3, d__4, d__5, d__6;
00026    
00027    /* Local variables */
00028    int i__, m;
00029    double dtemp;
00030    int nincx, mp1;
00031    
00032    
00033    /*     takes the sum of the absolute values. */
00034    /*     jack dongarra, linpack, 3/11/78. */
00035    /*     modified 3/93 to return if incx .le. 0. */
00036    /*     modified 12/3/93, array(1) declarations changed to array(*) */
00037    
00038    
00039    /* Parameter adjustments */
00040    --dx;
00041    
00042    /* Function Body */
00043    ret_val = 0.;
00044    dtemp = 0.;
00045    if (n <= 0 || incx <= 0) {
00046       return ret_val;
00047    }
00048    if (incx == 1) {
00049       goto L20;
00050    }
00051    
00052    /*        code for increment not equal to 1 */
00053    
00054    nincx = n * incx;
00055    i__1 = nincx;
00056    i__2 = incx;
00057    for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
00058       dtemp += (d__1 = dx[i__], fabs(d__1));
00059       /* L10: */
00060    }
00061    ret_val = dtemp;
00062    return ret_val;
00063    
00064    /*        code for increment equal to 1 */
00065    
00066    
00067    /*        clean-up loop */
00068    
00069 L20:
00070       m = n % 6;
00071    if (m == 0) {
00072       goto L40;
00073    }
00074    i__2 = m;
00075    for (i__ = 1; i__ <= i__2; ++i__) {
00076       dtemp += (d__1 = dx[i__], fabs(d__1));
00077       /* L30: */
00078    }
00079    if (n < 6) {
00080       goto L60;
00081    }
00082 L40:
00083       mp1 = m + 1;
00084    i__2 = n;
00085    for (i__ = mp1; i__ <= i__2; i__ += 6) {
00086       dtemp = dtemp + (d__1 = dx[i__], fabs(d__1)) + (d__2 = dx[i__ + 1], 
00087                                                       fabs(d__2)) + (d__3 = dx[i__ + 2], fabs(d__3)) + 
00088       (d__4 = dx[i__ + 3], fabs(d__4)) + 
00089       (d__5 = dx[i__ + 4], fabs(d__5)) + (d__6 = dx[i__ + 5], fabs(d__6));
00090       /* L50: */
00091    }
00092 L60:
00093       ret_val = dtemp;
00094    return ret_val;
00095 } /* dasum_ */
00096 
00097 
00098    }  // namespace Minuit2
00099 
00100 }  // namespace ROOT

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