28 double F1(
const double *xx) {
32 double F2(
const double *xx) {
33 double x = xx[0];
double y = xx[1];
34 return b * (y - x*
x );
38 double DerivF1(
const double *,
int icoord) {
39 if (icoord == 0)
return -
a;
42 double DerivF2(
const double *xx,
int icoord) {
44 if (icoord == 0)
return -2 *
b *
x;
73 double x0[] = {-1.,-1.};
75 bool ret = rf.
Solve(x0);
78 std::cerr <<
"testMultiRootFinder - Error running derivative algorithm " << std::endl;
86 std::vector<ROOT::Math::IMultiGenFunction*> funlist;
87 funlist.push_back(&f1);
88 funlist.push_back(&f2);
93 bool ret2 = rf2.
Solve(x0);
95 std::cerr <<
"testMultiRootFinder - Error running non-derivative algorithm " << std::endl;
104 int main (
int argc,
char **argv) {
112 std::cout <<
"testMultiRootFinder --- \t" <<
"OK" << std::endl;
115 std::cerr <<
"testMultiRootFinder --- \t" <<
"FAILED ! " <<
"\t with status = " << status << std::endl;
Class for Multidimensional root finding algorithms bassed on GSL.
GradFunctor class for Multidimensional gradient functions.
Documentation for class Functor class.
bool SetFunctionList(FuncIterator begin, FuncIterator end)
bool Solve(const double *x, int maxIter=0, double absTol=0, double relTol=0)
Find the root starting from the point X; Use the number of iteration and tolerance if given otherwise...
int main(int argc, char **argv)
int AddFunction(const ROOT::Math::IMultiGenFunction &func)
int testMultiRootFinder()
int Status() const
Return the status of last root finding.
double f2(const double *x)
you should not use this method at all Int_t Int_t Double_t Double_t Double_t Int_t Double_t Double_t Double_t Double_t b
void SetPrintLevel(int level)
void PrintState(std::ostream &os=std::cout)
print iteration state