Logo ROOT  
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 
15 namespace ROOT {
16 
17  namespace Minuit2 {
18 
19 
20 template<class mtype, class M, class T>
21 class ABObj {
22 
23 public:
24 
25  typedef mtype Type;
26 
27 private:
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 
39 public:
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 
58 private:
59 
60  M fObject;
61  T fFactor;
62 };
63 
64 class LAVector;
65 template <> class ABObj<vec, LAVector, double> {
66 
67 public:
68 
69  typedef vec Type;
70 
71 private:
72 
73  ABObj& operator=(const ABObj&) = delete;
74 
75 public:
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 
96 private:
97 
98  const LAVector& fObject;
99  double fFactor;
100 };
101 
103 template <> class ABObj<sym, LASymMatrix, double> {
104 
105 public:
106 
107  typedef sym Type;
108 
109 private:
110 
111  ABObj& operator=(const ABObj&) {return *this;}
112 
113 public:
114 
115  ABObj(const LASymMatrix& obj) : fObject(obj), fFactor(double(1.)) {}
116 
117  ABObj(const LASymMatrix& obj, double factor) : fObject(obj), fFactor(factor) {}
118 
119  ~ABObj() {}
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 
132 private:
133 
134  const LASymMatrix& fObject;
135  double fFactor;
136 };
137 
138 // templated scaling operator *
139 template<class mt, class M, class T>
140 inline ABObj<mt, M, T> operator*(T f, const M& obj) {
141  return ABObj<mt, M, T>(obj, f);
142 }
143 
144 // templated operator /
145 template<class mt, class M, class T>
146 inline 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 -
151 template<class mt, class M, class T>
152 inline 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 
159 inline ABObj<vec, LAVector, double> operator*(double f, const LAVector& obj) {
160  return ABObj<vec, LAVector, double>(obj, f);
161 }
162 
163 inline ABObj<vec, LAVector, double> operator/(const LAVector& obj, double f) {
164  return ABObj<vec, LAVector, double>(obj, double(1.)/f);
165 }
166 
167 inline 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
ROOT::Minuit2::operator*
ABObj< mt, M, T > operator*(T f, const M &obj)
Definition: ABObj.h:148
ROOT::Minuit2::ABObj::~ABObj
~ABObj()
Definition: ABObj.h:57
f
#define f(i)
Definition: RSha256.hxx:122
ROOT::Minuit2::vec
Definition: ABTypes.h:28
ROOT::Minuit2::LAVector
Definition: LAVector.h:41
ROOT::Minuit2::ABObj::f
T f() const
Definition: ABObj.h:68
ROOT::Minuit2::ABObj
Definition: ABObj.h:29
ROOT::Minuit2::LASymMatrix
Class describing a symmetric matrix of size n.
Definition: LASymMatrix.h:59
ROOT::Minuit2::operator-
ABObj< mt, M, T > operator-(const M &obj)
Definition: ABObj.h:160
ROOT::Minuit2::operator/
ABObj< mt, M, T > operator/(const M &obj, T f)
Definition: ABObj.h:154
ABTypes.h
ROOT::Minuit2::ABObj< sym, LASymMatrix, double >::ABObj
ABObj(const LASymMatrix &obj, double factor)
Definition: ABObj.h:125
double
double
Definition: Converters.cxx:921
ROOT::Minuit2::ABObj::fFactor
T fFactor
Definition: ABObj.h:73
ROOT::Minuit2::sym
Definition: ABTypes.h:27
ROOT::Minuit2::ABObj::fObject
M fObject
Definition: ABObj.h:72
ROOT::Minuit2::ABObj::Obj
const M & Obj() const
Definition: ABObj.h:66
ROOT::Minuit2::ABObj::ABObj
ABObj()
Definition: ABObj.h:41
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:52
ROOT::Minuit2::ABObj::operator=
ABObj & operator=(const ABObj &)
Definition: ABObj.h:43
ROOT::Minuit2::ABObj::Type
mtype Type
Definition: ABObj.h:37
ROOT
VSD Structures.
Definition: StringConv.hxx:21