[root] / trunk / math / mathcore / inc / Math / Util.h Repository:
ViewVC logotype

View of /trunk/math/mathcore/inc/Math/Util.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 25486 - (download) (as text) (annotate)
Mon Sep 22 12:43:03 2008 UTC (6 years, 4 months ago) by moneta
File size: 1574 byte(s)
import changes from math development branches for subdirectory math. List of changes in detail: 

mathcore: 
---------
  MinimizerOptions: 
	new  class for storing Minimizer option, with static default values that can be 
	changed by the user

  FitConfig: 
   	- use default values from MinimizerOption class
   	- rename method to create parameter settings from a function

  FitUtil.cxx:   
    	improve the derivative calculations used in the effective chi2 and in Fumili and 
	fix a bug for evaluation of likelihood or chi2 terms. 
	In  EvaluatePdf() work and return  the log of the pdf. 
      
  FitResult:
	- improve the class by adding extra information like, num. of free parameters, 
	minimizer status, global correlation coefficients, information about fixed 
	and bound parameters. 
   	- add method for getting fit confidence intervals 
  	- improve print method   

  DataRange: 
	add method SetRange to distinguish from AddRange. SetRange deletes the existing 
	ranges. 

  ParamsSettings: make few methods const

  FCN functions (Chi2FCN, LogLikelihoodFCN, etc..) 
	move some common methods and data members in base class (FitMethodFunction)

  RootFinder: add template Solve() for any callable function.  

mathmore:
--------
  minimizer classes: fill status information
  GSLNLSMinimizer: return error and covariance matrix 

minuit2: 
-------
  Minuit2Minimizer: fill  status information 
  DavidonErrorUpdator: check that delgam or gvg are not zero ( can happen when dg = 0)
  FumiliFCNAdapter: work on the log of pdf

minuit:
------- 
  TLinearMinimizer: add support for robust fitting
  TMinuitMinimizer: fill status information and fix a bug in filling the correlation matrix. 
 fumili:
 ------ 
  add TFumiliMinimizer: 
	wrapper class for TFumili using Minimizer interface

// @(#)root/mathcore:$Id$
// Author: L. Moneta Tue Nov 14 15:44:38 2006

/**********************************************************************
 *                                                                    *
 * Copyright (c) 2006  LCG ROOT Math Team, CERN/PH-SFT                *
 *                                                                    *
 *                                                                    *
 **********************************************************************/

// Utility functions for all ROOT Math classes 

#ifndef ROOT_Math_Util
#define ROOT_Math_Util

#include <string> 
#include <sstream> 

#include <cmath>
#include <limits>

namespace ROOT { 

   namespace Math { 



/** 
   namespace defining Utility functions needed by mathcore 
*/ 
namespace Util { 

/**
   Utility function for conversion to strings
*/
template<class T>
std::string ToString(const T& val)
{
   std::ostringstream buf;
   buf << val;
   
   std::string ret = buf.str();
   return ret;
}


/// safe evaluation of log(x) with a protections against negative or zero argument to the log 
/// smooth linear extrapolation below function values smaller than  epsilon
/// (better than a simple cut-off)
inline double EvalLog(double x) { 
   // evaluate the log 
   const static double epsilon = 2.*std::numeric_limits<double>::min();
   if(x<= epsilon) 
      return x/epsilon + std::log(epsilon) - 1; 
   else      
      return std::log(x);
}
 
}  // end namespace Util


   } // end namespace Math

} // end namespace ROOT


#endif /* ROOT_Math_Util */

Subversion Admin
ViewVC Help
Powered by ViewVC 1.0.9