npstat is hosted by Hepforge, IPPP Durham
NPStat  5.10.0
findRootInLogSpace.hh
Go to the documentation of this file.
1 #ifndef NPSTAT_FINDROOTINLOGSPACE_HH_
2 #define NPSTAT_FINDROOTINLOGSPACE_HH_
3 
4 /*!
5 // \file findRootInLogSpace.hh
6 //
7 // \brief Root finding in the log space by interval division
8 //
9 // Author: I. Volobouev
10 //
11 // November 2011
12 */
13 
15 
16 namespace npstat {
17  /**
18  // Numerical equation solving for 1-d functions using interval division.
19  //
20  // Input arguments are as follows:
21  //
22  // f -- The functor making up the equation to solve: f(x) == rhs.
23  // The comparison operator "<" must be defined for the Result
24  // type.
25  //
26  // rhs -- The "right hand side" of the equation.
27  //
28  // x0 -- The starting point for the search. For Arg1, operation of
29  // multiplication by a double must be defined. The space
30  // searched for solution will be x0*c, where c is a positive
31  // constant (for example, Arg1 can be a vector).
32  //
33  // tol -- Tolerance parameter. Typically, the found solution
34  // will be within a factor of 1 +- tol of the real one.
35  //
36  // x -- Location where the solution will be stored.
37  //
38  // logstep -- Initial step in the log space. The code will first try
39  // the points x0*exp(logstep) and x0/exp(logstep) to bound
40  // the root, and will descend along the slope from there.
41  //
42  // The function returns "true" if it finds the root, "false" otherwise.
43  */
44  template <typename Result, typename Arg1>
46  const Result& rhs, const Arg1& x0,
47  double tol, Arg1* x,
48  double logstep = 0.5);
49 }
50 
51 #include "npstat/nm/findRootInLogSpace.icc"
52 
53 #endif // NPSTAT_FINDROOTINLOGSPACE_HH_
Interface definitions and concrete simple functors for a variety of functor-based calculations.
Definition: AbsArrayProjector.hh:14
bool findRootInLogSpace(const Functor1< Result, Arg1 > &f, const Result &rhs, const Arg1 &x0, double tol, Arg1 *x, double logstep=0.5)
Definition: SimpleFunctors.hh:58