ParametricFunction.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: ParametricFunction.cxx 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 #include "Minuit2/ParametricFunction.h"
00011 #include "Minuit2/MnFcn.h"
00012 #include "Minuit2/MnStrategy.h"
00013 #include "Minuit2/MnUserParameterState.h"
00014 #include "Minuit2/Numerical2PGradientCalculator.h"
00015 #include "Minuit2/FunctionGradient.h"
00016 #include "Minuit2/MnVectorTransform.h"
00017 
00018 namespace ROOT {
00019 
00020    namespace Minuit2 {
00021 
00022 //#include "Minuit2/MnPrint.h"
00023 
00024 
00025 
00026 std::vector<double>  ParametricFunction::GetGradient(const std::vector<double>& x) const { 
00027    // calculate the numerical gradient (using Numerical2PGradientCalculator) 
00028 
00029    //LM:  this I believe is not very efficient
00030    MnFcn mfcn(*this);
00031    
00032    MnStrategy strategy(1);
00033    
00034    // ????????? how does it know the transformation????????
00035    std::vector<double> err(x.size());
00036    err.assign(x.size(), 0.1);
00037    // need to use parameters 
00038    MnUserParameterState st(x, err);
00039    
00040    Numerical2PGradientCalculator gc(mfcn, st.Trafo(), strategy);
00041    FunctionGradient g = gc(x); 
00042    const MnAlgebraicVector & grad = g.Vec();
00043    assert( grad.size() == x.size() );
00044    MnVectorTransform vt; 
00045    //  std::cout << "Param Function Gradient " << grad << std::endl; 
00046    return vt( grad ); 
00047 }
00048 
00049    }  // namespace Minuit2
00050 
00051 }  // namespace ROOT

Generated on Tue Jul 5 14:37:11 2011 for ROOT_528-00b_version by  doxygen 1.5.1