Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:10:17

0001 // @(#)root/mathmore:$Id$
0002 // Author: L. Moneta Wed Oct 18 11:48:00 2006
0003 
0004  /**********************************************************************
0005   *                                                                    *
0006   * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
0007   *                                                                    *
0008   * This library is free software; you can redistribute it and/or      *
0009   * modify it under the terms of the GNU General Public License        *
0010   * as published by the Free Software Foundation; either version 2     *
0011   * of the License, or (at your option) any later version.             *
0012   *                                                                    *
0013   * This library is distributed in the hope that it will be useful,    *
0014   * but WITHOUT ANY WARRANTY; without even the implied warranty of     *
0015   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   *
0016   * General Public License for more details.                           *
0017   *                                                                    *
0018   * You should have received a copy of the GNU General Public License  *
0019   * along with this library (see file COPYING); if not, write          *
0020   * to the Free Software Foundation, Inc., 59 Temple Place, Suite      *
0021   * 330, Boston, MA 02111-1307 USA, or contact the author.             *
0022   *                                                                    *
0023   **********************************************************************/
0024 
0025 
0026 // Header file for class GSLMinimizer
0027 
0028 #ifndef ROOT_Math_GSLMinimizer
0029 #define ROOT_Math_GSLMinimizer
0030 
0031 #include "Math/Minimizer.h"
0032 
0033 #include "Math/IFunctionfwd.h"
0034 
0035 #include "Math/IParamFunctionfwd.h"
0036 
0037 #include "Math/BasicMinimizer.h"
0038 
0039 
0040 namespace ROOT {
0041 
0042 namespace Math {
0043 
0044 
0045    /**
0046       enumeration specifying the types of GSL minimizers
0047       @ingroup MultiMin
0048    */
0049    enum EGSLMinimizerType {
0050       kConjugateFR,
0051       kConjugatePR,
0052       kVectorBFGS,
0053       kVectorBFGS2,
0054       kSteepestDescent
0055    };
0056 
0057 
0058    class GSLMultiMinimizer;
0059 
0060    class MinimTransformFunction;
0061 
0062 
0063 //_____________________________________________________________________________________
0064 /**
0065    GSLMinimizer class.
0066    Implementation of the ROOT::Math::Minimizer interface using the GSL multi-dimensional
0067    minimization algorithms.
0068 
0069    See <A HREF="http://www.gnu.org/software/gsl/manual/html_node/Multidimensional-Minimization.html">GSL doc</A>
0070    from more info on the GSL minimization algorithms.
0071 
0072    The class implements the ROOT::Math::Minimizer interface and can be instantiated using the
0073    ROOT plugin manager (plugin name is "GSLMultiMin"). The various minimization algorithms
0074    (conjugatefr, conjugatepr, bfgs, etc..) can be passed as enumerations and also as a string.
0075    The default algorithm is conjugatefr (Fletcher-Reeves conjugate gradient algorithm).
0076 
0077    @ingroup MultiMin
0078 */
0079 class GSLMinimizer : public ROOT::Math::BasicMinimizer {
0080 
0081 public:
0082 
0083    /**
0084       Default constructor
0085    */
0086    GSLMinimizer (ROOT::Math::EGSLMinimizerType type = ROOT::Math::kConjugateFR  );
0087 
0088    /**
0089       Constructor with a string giving name of algorithm
0090     */
0091    GSLMinimizer (const char *  type  );
0092 
0093    /**
0094       Destructor
0095    */
0096    ~GSLMinimizer () override;
0097 
0098 private:
0099    // usually copying is non trivial, so we make this unaccessible
0100 
0101    /**
0102       Copy constructor
0103    */
0104    GSLMinimizer(const GSLMinimizer &) : BasicMinimizer() {}
0105 
0106    /**
0107       Assignment operator
0108    */
0109    GSLMinimizer & operator = (const GSLMinimizer & rhs) {
0110       if (this == &rhs) return *this;  // time saving self-test
0111       return *this;
0112    }
0113 
0114 public:
0115 
0116    /// set the function to minimize
0117    void SetFunction(const ROOT::Math::IMultiGenFunction & func) override;
0118 
0119 
0120    /// method to perform the minimization
0121     bool Minimize() override;
0122 
0123 
0124    /// return expected distance reached from the minimum
0125    double Edm() const override { return 0; } // not impl. }
0126 
0127 
0128    /// return pointer to gradient values at the minimum
0129    const double *  MinGradient() const override;
0130 
0131    /// number of function calls to reach the minimum
0132    unsigned int NCalls() const override;
0133 
0134 
0135    /// minimizer provides error and error matrix
0136    bool ProvidesError() const override { return false; }
0137 
0138    /// return errors at the minimum
0139    const double * Errors() const override { return nullptr; }
0140 
0141    /** return covariance matrices elements
0142        if the variable is fixed the matrix is zero
0143        The ordering of the variables is the same as in errors
0144    */
0145    double CovMatrix(unsigned int , unsigned int ) const override { return 0; }
0146 
0147 
0148 
0149 
0150 protected:
0151 
0152 private:
0153 
0154 
0155    ROOT::Math::GSLMultiMinimizer * fGSLMultiMin;
0156 
0157    double fLSTolerance;  // Line Search Tolerance
0158 
0159 };
0160 
0161    } // end namespace Fit
0162 
0163 } // end namespace ROOT
0164 
0165 
0166 
0167 #endif /* ROOT_Math_GSLMinimizer */