Logo ROOT   6.08/07
Reference Guide
MinimTransformVariable.h
Go to the documentation of this file.
1 // @(#)root/mathmore:$Id$
2 // Author: L. Moneta 2009
3 
4 /**********************************************************************
5  * *
6  * Copyright (c) 2006 LCG ROOT Math Team, CERN/PH-SFT *
7  * *
8  * *
9  **********************************************************************/
10 // Header file for class MinimizerVariable
11 
12 #ifndef ROOT_Math_MinimizerVariable
13 #define ROOT_Math_MinimizerVariable
14 
15 #ifndef ROOT_Math_MinimizerVariableTransformation
17 #endif
18 
19 #include <memory>
20 
21 namespace ROOT {
22 
23  namespace Math {
24 
25  /**
26  Enumeration describing the status of the variable
27  The enumeration are used in the minimizer classes to categorize the variables
28  */
30  kDefault, // free variable (unlimited)
31  kFix, // fixed variable
32  kBounds, // variable has two bounds
33  kLowBound, // variable has a lower bound
34  kUpBound // variable has an upper bounds
35  };
36 
37 
38 
39 /**
40  MinimTransformVariable class
41  Contains meta information of the variables such as bounds, fix flags and
42  deals with transformation of the variable
43  The class does not contain the values and the step size (error) of the variable
44  This is an internal class used by the MinimTransformFunction class
45 
46  @ingroup MultiMin
47 */
48 
49 
51 
52 public:
53 
54  /**
55  Default Constructor for an unlimited variable
56  */
58  fFix(false), fLowBound(false), fUpBound(false), fBounds(false),
59  fLower(1), fUpper(0)
60  {}
61 
62  // constructor for fixed variable
63  MinimTransformVariable (double value) :
64  fFix(true), fLowBound(false), fUpBound(false), fBounds(false),
65  fLower(value), fUpper(value)
66  {}
67 
68  // constructor for double bound variable
69  MinimTransformVariable (double lower, double upper, SinVariableTransformation * trafo) :
70  fFix(false), fLowBound(false), fUpBound(false), fBounds(true),
71  fTransform(trafo),
72  fLower(lower), fUpper(upper)
73  { }
74 
75  // constructor for lower bound variable
77  fFix(false), fLowBound(true), fUpBound(false), fBounds(false),
78  fTransform(trafo), fLower(lower), fUpper(lower)
79  {}
80 
81  // constructor for upper bound variable
83  fFix(false), fLowBound(true), fUpBound(false), fBounds(false),
84  fTransform(trafo), fLower(upper), fUpper(upper)
85  {}
86 
87  // copy constructor
90  fLower(rhs.fLower), fUpper(rhs.fUpper)
91  {
92  // swap auto_ptr
93  fTransform.swap( const_cast<MinimTransformVariable &>( rhs).fTransform) ;
94  }
95 
96  // assignment
98  if (&rhs == this) return *this;
99  fFix = rhs.fFix;
100  fLowBound = rhs.fLowBound;
101  fUpBound = rhs.fUpBound;
102  fBounds = rhs.fBounds;
103  fLower = rhs.fLower; fUpper = rhs.fUpper;
104 
105  // swap auto_ptr
106  fTransform.swap( const_cast<MinimTransformVariable &>( rhs).fTransform) ;
107  return *this;
108  }
109 
110 
111  bool IsFixed() const { return fFix; }
112 
113  bool IsLimited() const { return fBounds || fLowBound || fUpBound; }
114 
115  bool HasLowerBound() const { return fLowBound || fBounds; }
116 
117  bool HasUpperBound() const { return fUpBound || fBounds; }
118 
119  double LowerBound() const { return fLower; }
120 
121  double UpperBound() const { return fUpper; }
122 
123  double FixValue() const { return fLower; }
124 
125  // internal to external transformation
126  double InternalToExternal( double x) const {
127  return (fTransform.get() ) ? fTransform->Int2ext(x, fLower, fUpper) : x;
128  }
129 
130  // derivative of the internal to external transformation ( d Int2Ext / d int )
131  double DerivativeIntToExt ( double x) const {
132  return (fTransform.get() ) ? fTransform->DInt2Ext( x, fLower, fUpper) : 1.0;
133  }
134 
135  // etxernal to internal transformation
136  double ExternalToInternal(double x) const {
137  return (fTransform.get() ) ? fTransform->Ext2int(x, fLower, fUpper) : x;
138  }
139 
140 private:
141 
142  bool fFix; // fix variable
143  bool fLowBound; // has lower bound
144  bool fUpBound; // has uppper bound param
145  bool fBounds; // has double bound
146  std::unique_ptr< MinimizerVariableTransformation> fTransform; // pointer to the minimizer transformation
147  double fLower; // lower parameter limit
148  double fUpper; // upper parameter limit
149 
150 };
151 
152  } // end namespace Math
153 
154 } // end namespace ROOT
155 
156 
157 #endif /* ROOT_Math_MinimTransformVariable */
158 
159 
MinimTransformVariable(double lower, double upper, SinVariableTransformation *trafo)
EMinimVariableType
Enumeration describing the status of the variable The enumeration are used in the minimizer classes t...
This namespace contains pre-defined functions to be used in conjuction with TExecutor::Map and TExecu...
Definition: StringConv.hxx:21
MinimTransformVariable()
Default Constructor for an unlimited variable.
Double_t x[n]
Definition: legend1.C:17
MinimTransformVariable(double upper, SqrtUpVariableTransformation *trafo)
Sqrt Transformation class for dealing with upper bounded variables.
MinimTransformVariable class Contains meta information of the variables such as bounds, fix flags and deals with transformation of the variable The class does not contain the values and the step size (error) of the variable This is an internal class used by the MinimTransformFunction class.
std::unique_ptr< MinimizerVariableTransformation > fTransform
MinimTransformVariable(const MinimTransformVariable &rhs)
MinimTransformVariable(double lower, SqrtLowVariableTransformation *trafo)
Namespace for new Math classes and functions.
MinimTransformVariable & operator=(const MinimTransformVariable &rhs)
Sin Transformation class for dealing with double bounded variables.
Sqrt Transformation class for dealing with lower bounded variables.