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;
54 using namespace ROOT::Math;
73 double x0[] = {-1.,-1.};
75 std::cout <<
"Testing Multi-RootFinder - ";
76 bool ret = rf.
Solve(x0);
79 std::cout << rf.
Name() <<
"\t : FAILED\n";
80 std::cerr <<
"testMultiRootFinder - Error running derivative algorithm " << std::endl;
85 std::cout << rf.
Name() <<
"\t : OK\n";
91 std::vector<ROOT::Math::IMultiGenFunction*> funlist;
92 funlist.push_back(&f1);
93 funlist.push_back(&f2);
98 std::cout <<
"Testing Multi-RootFinder - ";
99 bool ret2 = rf2.
Solve(x0);
101 std::cout << rf2.
Name() <<
"\t : FAILED\n";
102 std::cout <<
"\t FAILED\n";
103 std::cerr <<
"testMultiRootFinder - Error running non-derivative algorithm " << std::endl;
104 if (printlevel == 0) rf2.
PrintState(std::cout);
105 status += 10*rf2.
Status();
108 std::cout << rf2.
Name() <<
"\t : OK\n";
114 int main (
int argc,
char **argv) {
118 printlevel = atoi(argv[1]);
122 std::cout <<
"testMultiRootFinder --- \t" <<
"OK" << std::endl;
125 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)
int Status() const
Return the status of last root finding.
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 AddFunction(const ROOT::Math::IMultiGenFunction &func)
int testMultiRootFinder()
const char * Name() const
Return the algorithm name used for solving Note the name is available only after having called solved...
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
int main(int argc, char **argv)