28 #ifndef ROOT_Math_GSLMultiRootFinder
29 #define ROOT_Math_GSLMultiRootFinder
45 class GSLMultiRootBaseSolver;
95 class GSLMultiRootFinder {
125 GSLMultiRootFinder(EType type);
128 GSLMultiRootFinder(EDerivType type);
136 GSLMultiRootFinder(
const char * name = 0);
139 virtual ~GSLMultiRootFinder();
143 GSLMultiRootFinder(
const GSLMultiRootFinder &);
144 GSLMultiRootFinder & operator = (
const GSLMultiRootFinder &);
149 void SetType(EType type) {
150 fType = type; fUseDerivAlgo =
false;
154 void SetType(EDerivType type) {
155 fType = type; fUseDerivAlgo =
true;
159 void SetType(
const char * name);
170 template<
class FuncIterator>
171 bool SetFunctionList( FuncIterator begin, FuncIterator end) {
173 for (FuncIterator itr = begin; itr != end; ++itr) {
174 const ROOT::Math::IMultiGenFunction * f = *itr;
177 ret &= (AddFunction( *f) != 0);
189 int AddFunction(
const ROOT::Math::IMultiGenFunction & func);
193 template <
class Function>
194 int AddFunction( Function & f,
int ndim) {
196 WrappedMultiFunction<Function &> wfunc(f, ndim);
197 return AddFunction(wfunc);
204 unsigned int Dim()
const {
return fFunctions.size(); }
210 const double * X()
const;
214 const double * FVal()
const;
217 const double * Dx()
const;
226 bool Solve(
const double * x,
int maxIter = 0,
double absTol = 0,
double relTol = 0);
229 int Iterations()
const {
234 int Status()
const {
return fStatus; }
239 const char * Name()
const;
247 void SetPrintLevel(
int level) { fPrintLevel = level; }
250 int PrintLevel()
const {
return fPrintLevel; }
258 static void SetDefaultTolerance(
double abstol,
double reltol = 0 );
261 static void SetDefaultMaxIterations(
int maxiter);
264 void PrintState(std::ostream & os = std::cout);
270 std::pair<bool,int> GetType(
const char * name);
272 void ClearFunctions();
287 GSLMultiRootBaseSolver * fSolver;
288 std::vector<ROOT::Math::IMultiGenFunction *> fFunctions;
294 typedef GSLMultiRootFinder MultiRootFinder;