Skip to content

Commit

Permalink
fix additional layout
Browse files Browse the repository at this point in the history
Just trying to keep the PR diff minimal.
  • Loading branch information
egpbos committed Jun 23, 2021
1 parent 472cdc1 commit 5477d93
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 39 deletions.
11 changes: 4 additions & 7 deletions math/mathcore/inc/Math/IFunction.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ namespace ROOT {
function to evaluate the derivative with respect each coordinate. To be implemented by the derived class
*/
virtual T DoDerivative(const T *x, unsigned int icoord) const = 0;

};

//___________________________________________________________________________________
Expand Down Expand Up @@ -322,6 +321,7 @@ namespace ROOT {
@ingroup GenFunc
*/

template <class T>
class IGradientFunctionMultiDimTempl : virtual public IBaseFunctionMultiDimTempl<T>,
public IGradientMultiDimTempl<T> {
Expand Down Expand Up @@ -356,14 +356,11 @@ namespace ROOT {
*/
virtual void FdF(const T *x, T &f, T *df) const
{
f = BaseFunc::operator()(x);
Gradient(x, df);
}

virtual bool returnsInMinuit2ParameterSpace() const {
return false;
f = BaseFunc::operator()(x);
Gradient(x, df);
}

virtual bool returnsInMinuit2ParameterSpace() const { return false; }
};

//___________________________________________________________________________________
Expand Down
6 changes: 3 additions & 3 deletions math/minuit2/src/AnalyticalGradientCalculator.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @(#)root/minuit2:$Id$
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei, E.G.P. Bos 2003-2017
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005

/**********************************************************************
* *
Expand All @@ -18,7 +18,6 @@
namespace ROOT {
namespace Minuit2 {


FunctionGradient AnalyticalGradientCalculator::operator()(const MinimumParameters &par) const
{
// evaluate analytical gradient. take care of parameter transformations
Expand Down Expand Up @@ -61,4 +60,5 @@ bool AnalyticalGradientCalculator::CheckGradient() const
}

} // namespace Minuit2
} // namespace ROOT

} // namespace ROOT
57 changes: 30 additions & 27 deletions math/minuit2/src/ExternalInternalGradientCalculator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,39 @@
#include "Minuit2/MinimumParameters.h"

namespace ROOT {
namespace Minuit2 {

FunctionGradient ExternalInternalGradientCalculator::operator()(const MinimumParameters& par) const {
// evaluate analytical gradient. take care of parameter transformations
std::vector<double> par_vec;
par_vec.resize(par.Vec().size());
for (std::size_t ix = 0; ix < par.Vec().size(); ++ix) {
par_vec[ix] = par.Vec()(ix);
}

std::vector<double> grad = fGradCalc.Gradient(par_vec);
assert(grad.size() == fTransformation.Parameters().size());

MnAlgebraicVector v(par.Vec().size());
for(unsigned int i = 0; i < par.Vec().size(); i++) {
unsigned int ext = fTransformation.ExtOfInt(i);
v(i) = grad[ext];
}
namespace Minuit2 {

FunctionGradient ExternalInternalGradientCalculator::operator()(const MinimumParameters &par) const
{
// evaluate analytical gradient. take care of parameter transformations
std::vector<double> par_vec;
par_vec.resize(par.Vec().size());
for (std::size_t ix = 0; ix < par.Vec().size(); ++ix) {
par_vec[ix] = par.Vec()(ix);
}

std::vector<double> grad = fGradCalc.Gradient(par_vec);
assert(grad.size() == fTransformation.Parameters().size());

MnAlgebraicVector v(par.Vec().size());
for (unsigned int i = 0; i < par.Vec().size(); i++) {
unsigned int ext = fTransformation.ExtOfInt(i);
v(i) = grad[ext];
}

#ifdef DEBUG
std::cout << "User given gradient in Minuit2" << v << std::endl;
std::cout << "User given gradient in Minuit2" << v << std::endl;
#endif

return FunctionGradient(v);
}
return FunctionGradient(v);
}

FunctionGradient ExternalInternalGradientCalculator::operator()(const MinimumParameters& par, const FunctionGradient&) const {
// needed from base class
return (*this)(par);
}
FunctionGradient
ExternalInternalGradientCalculator::operator()(const MinimumParameters &par, const FunctionGradient &) const
{
// needed from base class
return (*this)(par);
}

} // namespace Minuit2
} // namespace ROOT
} // namespace Minuit2
} // namespace ROOT
2 changes: 1 addition & 1 deletion math/minuit2/src/MnSeedGenerator.cxx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// @(#)root/minuit2:$Id$
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei, E.G.P. Bos 2003-2017
// Authors: M. Winkler, F. James, L. Moneta, A. Zsenei 2003-2005

/**********************************************************************
* *
Expand Down
2 changes: 1 addition & 1 deletion math/minuit2/src/SinParameterTransformation.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ long double SinParameterTransformation::DInt2Ext(long double Value, long double
return 0.5 * ((Upper - Lower) * std::cos(Value));
}

} // namespace Minuit2
} // namespace Minuit2

} // namespace ROOT

0 comments on commit 5477d93

Please sign in to comment.