ROOT  6.06/09
Reference Guide
mndasum.cxx
Go to the documentation of this file.
1 // @(#)root/minuit2:$Id$
2 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2005 LCG ROOT Math team, CERN/PH-SFT *
7  * *
8  **********************************************************************/
9 
10 /* dasum.f -- translated by f2c (version 20010320).
11  You must link the resulting object file with the libraries:
12  -lf2c -lm (in that order)
13 */
14 
15 #include <math.h>
16 
17 namespace ROOT {
18 
19  namespace Minuit2 {
20 
21 
22 double mndasum(unsigned int n, const double* dx, int incx) {
23  /* System generated locals */
24  int i__1, i__2;
25  double ret_val, d__1, d__2, d__3, d__4, d__5, d__6;
26 
27  /* Local variables */
28  int i__, m;
29  double dtemp;
30  int nincx, mp1;
31 
32 
33  /* takes the sum of the absolute values. */
34  /* jack dongarra, linpack, 3/11/78. */
35  /* modified 3/93 to return if incx .le. 0. */
36  /* modified 12/3/93, array(1) declarations changed to array(*) */
37 
38 
39  /* Parameter adjustments */
40  --dx;
41 
42  /* Function Body */
43  ret_val = 0.;
44  dtemp = 0.;
45  if (n <= 0 || incx <= 0) {
46  return ret_val;
47  }
48  if (incx == 1) {
49  goto L20;
50  }
51 
52  /* code for increment not equal to 1 */
53 
54  nincx = n * incx;
55  i__1 = nincx;
56  i__2 = incx;
57  for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
58  dtemp += (d__1 = dx[i__], fabs(d__1));
59  /* L10: */
60  }
61  ret_val = dtemp;
62  return ret_val;
63 
64  /* code for increment equal to 1 */
65 
66 
67  /* clean-up loop */
68 
69 L20:
70  m = n % 6;
71  if (m == 0) {
72  goto L40;
73  }
74  i__2 = m;
75  for (i__ = 1; i__ <= i__2; ++i__) {
76  dtemp += (d__1 = dx[i__], fabs(d__1));
77  /* L30: */
78  }
79  if (n < 6) {
80  goto L60;
81  }
82 L40:
83  mp1 = m + 1;
84  i__2 = n;
85  for (i__ = mp1; i__ <= i__2; i__ += 6) {
86  dtemp = dtemp + (d__1 = dx[i__], fabs(d__1)) + (d__2 = dx[i__ + 1],
87  fabs(d__2)) + (d__3 = dx[i__ + 2], fabs(d__3)) +
88  (d__4 = dx[i__ + 3], fabs(d__4)) +
89  (d__5 = dx[i__ + 4], fabs(d__5)) + (d__6 = dx[i__ + 5], fabs(d__6));
90  /* L50: */
91  }
92 L60:
93  ret_val = dtemp;
94  return ret_val;
95 } /* dasum_ */
96 
97 
98  } // namespace Minuit2
99 
100 } // namespace ROOT
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
TMarker * m
Definition: textangle.C:8
double mndasum(unsigned int, const double *, int)
Definition: mndasum.cxx:22
const Int_t n
Definition: legend1.C:16