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