|
||||
File indexing completed on 2025-01-18 10:10:18
0001 // @(#)root/mathcore:$Id$ 0002 // Authors: David Gonzalez Maline 01/2008 0003 0004 /********************************************************************** 0005 * * 0006 * Copyright (c) 2006 , LCG ROOT MathLib Team * 0007 * * 0008 * * 0009 **********************************************************************/ 0010 0011 // Header for the IRootFinderMethod interface 0012 // 0013 // Created by: David Gonzalez Maline : Fri Jan 25 2008 0014 // 0015 0016 #ifndef ROOT_Math_IRootFinderMethod 0017 #define ROOT_Math_IRootFinderMethod 0018 0019 #include "Math/Error.h" 0020 0021 #include "Math/IFunctionfwd.h" 0022 0023 namespace ROOT { 0024 namespace Math { 0025 0026 //___________________________________________________________________________________________ 0027 /** 0028 Interface for finding function roots of one-dimensional functions 0029 0030 @ingroup RootFinders 0031 0032 */ 0033 0034 class IRootFinderMethod { 0035 public: 0036 /** Default Destructor. */ 0037 virtual ~IRootFinderMethod() {} 0038 0039 /** Default Constructor. */ 0040 IRootFinderMethod() {} 0041 0042 // Common functionality 0043 0044 /** Sets the function for algorithms using derivatives. */ 0045 virtual bool SetFunction(const ROOT::Math::IGradFunction&, double) 0046 { 0047 MATH_ERROR_MSG("SetFunction", "This method must be used with a Root Finder algorithm using derivatives"); 0048 return false; 0049 } 0050 0051 /** Sets the function for the rest of the algorithms. 0052 The parameters set the interval where the root has to be calculated. */ 0053 virtual bool SetFunction(const ROOT::Math::IGenFunction& , double , double ) 0054 { 0055 MATH_ERROR_MSG("SetFunction", "Algorithm requires derivatives"); 0056 return false; 0057 } 0058 0059 /** Returns the previously calculated root. */ 0060 virtual double Root() const = 0; 0061 0062 /** Returns the status of the previous estimate */ 0063 virtual int Status() const = 0; 0064 0065 // Methods to be Implemented in the derived classes 0066 0067 /** Stimates the root for the function. 0068 \@param maxIter maximum number of iterations. 0069 \@param absTol desired absolute error in the minimum position. 0070 \@param absTol desired relative error in the minimum position. 0071 */ 0072 virtual bool Solve(int maxIter = 100, double absTol = 1E-8, double relTol = 1E-10) = 0; 0073 0074 /** Return name of root finder algorithm */ 0075 virtual const char* Name() const = 0; 0076 0077 /** This method is implemented only by the GSLRootFinder 0078 and GSLRootFinderDeriv classes and will return an error if it's not one of them. */ 0079 virtual int Iterate() { 0080 MATH_ERROR_MSG("Iterate", "This method must be used with a Root Finder algorithm wrapping the GSL Library"); 0081 return -1; 0082 } 0083 0084 /** Return number of iterations used to find the root 0085 Must be implemented by derived classes 0086 */ 0087 virtual int Iterations() const { return -1; } 0088 0089 }; 0090 0091 } // namespace Math 0092 } // namespace ROOT 0093 0094 0095 #endif /* ROOT_Math_IRootFinderMethod */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |