Logo ROOT  
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 <cmath>
16
17namespace ROOT {
18
19namespace Minuit2 {
20
21double mndasum(unsigned int n, const double *dx, int incx)
22{
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 /* takes the sum of the absolute values. */
33 /* jack dongarra, linpack, 3/11/78. */
34 /* modified 3/93 to return if incx .le. 0. */
35 /* modified 12/3/93, array(1) declarations changed to array(*) */
36
37 /* Parameter adjustments */
38 --dx;
39
40 /* Function Body */
41 ret_val = 0.;
42 dtemp = 0.;
43 if (n <= 0 || incx <= 0) {
44 return ret_val;
45 }
46 if (incx == 1) {
47 goto L20;
48 }
49
50 /* code for increment not equal to 1 */
51
52 nincx = n * incx;
53 i__1 = nincx;
54 i__2 = incx;
55 for (i__ = 1; i__2 < 0 ? i__ >= i__1 : i__ <= i__1; i__ += i__2) {
56 dtemp += (d__1 = dx[i__], std::fabs(d__1));
57 /* L10: */
58 }
59 ret_val = dtemp;
60 return ret_val;
61
62 /* code for increment equal to 1 */
63
64 /* clean-up loop */
65
66L20:
67 m = n % 6;
68 if (m == 0) {
69 goto L40;
70 }
71 i__2 = m;
72 for (i__ = 1; i__ <= i__2; ++i__) {
73 dtemp += (d__1 = dx[i__], std::fabs(d__1));
74 /* L30: */
75 }
76 if (n < 6) {
77 goto L60;
78 }
79L40:
80 mp1 = m + 1;
81 i__2 = n;
82 for (i__ = mp1; i__ <= i__2; i__ += 6) {
83 dtemp = dtemp + (d__1 = dx[i__], std::fabs(d__1)) + (d__2 = dx[i__ + 1], std::fabs(d__2)) +
84 (d__3 = dx[i__ + 2], std::fabs(d__3)) + (d__4 = dx[i__ + 3], std::fabs(d__4)) +
85 (d__5 = dx[i__ + 4], std::fabs(d__5)) + (d__6 = dx[i__ + 5], std::fabs(d__6));
86 /* L50: */
87 }
88L60:
89 ret_val = dtemp;
90 return ret_val;
91} /* dasum_ */
92
93} // namespace Minuit2
94
95} // namespace ROOT
const Int_t n
Definition: legend1.C:16
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
double mndasum(unsigned int, const double *, int)
Definition: mndasum.cxx:21
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
TMarker m
Definition: textangle.C:8