Logo ROOT   6.16/01
Reference Guide
mnddot.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/* ddot.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
15namespace ROOT {
16
17 namespace Minuit2 {
18
19
20double mnddot(unsigned int n, const double* dx, int incx, const double* dy,
21 int incy) {
22 /* System generated locals */
23 int i__1;
24 double ret_val;
25
26 /* Local variables */
27 int i__, m;
28 double dtemp;
29 int ix, iy, mp1;
30
31
32 /* forms the dot product of two vectors. */
33 /* uses unrolled loops for increments equal to one. */
34 /* jack dongarra, linpack, 3/11/78. */
35 /* modified 12/3/93, array(1) declarations changed to array(*) */
36
37
38 /* Parameter adjustments */
39 --dy;
40 --dx;
41
42 /* Function Body */
43 ret_val = 0.;
44 dtemp = 0.;
45 if (n <= 0) {
46 return ret_val;
47 }
48 if (incx == 1 && incy == 1) {
49 goto L20;
50 }
51
52 /* code for unequal increments or equal increments */
53 /* not equal to 1 */
54
55 ix = 1;
56 iy = 1;
57 if (incx < 0) {
58 ix = (-static_cast<int>(n) + 1) * incx + 1;
59 }
60 if (incy < 0) {
61 iy = (-static_cast<int>(n) + 1) * incy + 1;
62 }
63 i__1 = n;
64 for (i__ = 1; i__ <= i__1; ++i__) {
65 dtemp += dx[ix] * dy[iy];
66 ix += incx;
67 iy += incy;
68 /* L10: */
69 }
70 ret_val = dtemp;
71 return ret_val;
72
73 /* code for both increments equal to 1 */
74
75
76 /* clean-up loop */
77
78L20:
79 m = n % 5;
80 if (m == 0) {
81 goto L40;
82 }
83 i__1 = m;
84 for (i__ = 1; i__ <= i__1; ++i__) {
85 dtemp += dx[i__] * dy[i__];
86 /* L30: */
87 }
88 if (n < 5) {
89 goto L60;
90 }
91L40:
92 mp1 = m + 1;
93 i__1 = n;
94 for (i__ = mp1; i__ <= i__1; i__ += 5) {
95 dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + dx[
96 i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + dx[i__ +
97 4] * dy[i__ + 4];
98 /* L50: */
99 }
100L60:
101 ret_val = dtemp;
102 return ret_val;
103} /* ddot_ */
104
105
106 } // namespace Minuit2
107
108} // namespace ROOT
const Int_t n
Definition: legend1.C:16
double mnddot(unsigned int, const double *, int, const double *, int)
Definition: mnddot.cxx:20
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
auto * m
Definition: textangle.C:8