Logo ROOT   6.18/05
Reference Guide
ABObj.h
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#ifndef ROOT_Minuit2_ABObj
11#define ROOT_Minuit2_ABObj
12
13#include "Minuit2/ABTypes.h"
14
15namespace ROOT {
16
17 namespace Minuit2 {
18
19
20template<class mtype, class M, class T>
21class ABObj {
22
23public:
24
25 typedef mtype Type;
26
27private:
28
29 ABObj() : fObject(M()), fFactor(T(0.)) {}
30
31 ABObj& operator=(const ABObj&) {return *this;}
32
33 template<class a, class b, class c>
34 ABObj(const ABObj<a,b,c>&) : fObject(M()), fFactor(T(0.)) {}
35
36 template<class a, class b, class c>
37 ABObj& operator=(const ABObj<a,b,c>&) {return *this;}
38
39public:
40
41 ABObj(const M& obj) : fObject(obj), fFactor(T(1.)) {}
42
43 ABObj(const M& obj, T factor) : fObject(obj), fFactor(factor) {}
44
45 ~ABObj() {}
46
47 ABObj(const ABObj& obj) :
48 fObject(obj.fObject), fFactor(obj.fFactor) {}
49
50 template<class b, class c>
51 ABObj(const ABObj<mtype,b,c>& obj) :
52 fObject(M(obj.Obj() )), fFactor(T(obj.f() )) {}
53
54 const M& Obj() const {return fObject;}
55
56 T f() const {return fFactor;}
57
58private:
59
62};
63
64class LAVector;
65template <> class ABObj<vec, LAVector, double> {
66
67public:
68
69 typedef vec Type;
70
71private:
72
73 ABObj& operator=(const ABObj&) = delete;
74
75public:
76
77 ABObj(const LAVector& obj) : fObject(obj), fFactor(double(1.)) {}
78
79 ABObj(const LAVector& obj, double factor) : fObject(obj), fFactor(factor) {}
80
81 ~ABObj() {}
82
83 // remove copy constructure to Fix a problem in AIX
84 // should be able to use the compiler generated one
85// ABObj(const ABObj& obj) :
86// fObject(obj.fObject), fFactor(obj.fFactor) {}
87
88 template<class c>
90 fObject(obj.fObject), fFactor(double(obj.fFactor)) {}
91
92 const LAVector& Obj() const {return fObject;}
93
94 double f() const {return fFactor;}
95
96private:
97
99 double fFactor;
100};
101
102class LASymMatrix;
103template <> class ABObj<sym, LASymMatrix, double> {
104
105public:
106
107 typedef sym Type;
108
109private:
110
111 ABObj& operator=(const ABObj&) {return *this;}
112
113public:
114
115 ABObj(const LASymMatrix& obj) : fObject(obj), fFactor(double(1.)) {}
116
117 ABObj(const LASymMatrix& obj, double factor) : fObject(obj), fFactor(factor) {}
118
120
121 ABObj(const ABObj& obj) :
122 fObject(obj.fObject), fFactor(obj.fFactor) {}
123
124 template<class c>
126 fObject(obj.fObject), fFactor(double(obj.fFactor)) {}
127
128 const LASymMatrix& Obj() const {return fObject;}
129
130 double f() const {return fFactor;}
131
132private:
133
135 double fFactor;
136};
137
138// templated scaling operator *
139template<class mt, class M, class T>
140inline ABObj<mt, M, T> operator*(T f, const M& obj) {
141 return ABObj<mt, M, T>(obj, f);
142}
143
144// templated operator /
145template<class mt, class M, class T>
146inline ABObj<mt, M, T> operator/(const M& obj, T f) {
147 return ABObj<mt, M, T>(obj, T(1.)/f);
148}
149
150// templated unary operator -
151template<class mt, class M, class T>
152inline ABObj<mt,M,T> operator-(const M& obj) {
153 return ABObj<mt,M,T>(obj, T(-1.));
154}
155
156/*
157// specialization for LAVector
158
159inline ABObj<vec, LAVector, double> operator*(double f, const LAVector& obj) {
160 return ABObj<vec, LAVector, double>(obj, f);
161}
162
163inline ABObj<vec, LAVector, double> operator/(const LAVector& obj, double f) {
164 return ABObj<vec, LAVector, double>(obj, double(1.)/f);
165}
166
167inline ABObj<vec,LAVector,double> operator-(const LAVector& obj) {
168 return ABObj<vec,LAVector,double>(obj, double(-1.));
169}
170*/
171
172 } // namespace Minuit2
173
174} // namespace ROOT
175
176#endif // ROOT_Minuit2_ABObj
#define f(i)
Definition: RSha256.hxx:104
ABObj(const ABObj< vec, LASymMatrix, c > &obj)
Definition: ABObj.h:125
ABObj(const LASymMatrix &obj, double factor)
Definition: ABObj.h:117
const LASymMatrix & Obj() const
Definition: ABObj.h:128
ABObj(const LAVector &obj, double factor)
Definition: ABObj.h:79
const LAVector & Obj() const
Definition: ABObj.h:92
ABObj(const ABObj< vec, LAVector, c > &obj)
Definition: ABObj.h:89
ABObj & operator=(const ABObj &)=delete
ABObj(const ABObj< a, b, c > &)
Definition: ABObj.h:34
ABObj(const M &obj, T factor)
Definition: ABObj.h:43
const M & Obj() const
Definition: ABObj.h:54
ABObj(const ABObj &obj)
Definition: ABObj.h:47
ABObj(const M &obj)
Definition: ABObj.h:41
ABObj & operator=(const ABObj< a, b, c > &)
Definition: ABObj.h:37
T f() const
Definition: ABObj.h:56
ABObj & operator=(const ABObj &)
Definition: ABObj.h:31
ABObj(const ABObj< mtype, b, c > &obj)
Definition: ABObj.h:51
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:51
double T(double x)
Definition: ChebyshevPol.h:34
ABObj< mt, M, T > operator*(T f, const M &obj)
Definition: ABObj.h:140
ABObj< mt, M, T > operator-(const M &obj)
Definition: ABObj.h:152
ABObj< mt, M, T > operator/(const M &obj, T f)
Definition: ABObj.h:146
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21