File indexing completed on 2025-12-16 10:29:39
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef ROOT_Minuit2_FunctionGradient
0011 #define ROOT_Minuit2_FunctionGradient
0012
0013 #include "Minuit2/MnMatrix.h"
0014
0015 #include <memory>
0016
0017 namespace ROOT {
0018
0019 namespace Minuit2 {
0020
0021 class FunctionGradient {
0022
0023 private:
0024 public:
0025 explicit FunctionGradient(unsigned int n)
0026 : fPtr{new Data{MnAlgebraicVector(n), MnAlgebraicVector(n), MnAlgebraicVector(n), false, false, false}}
0027 {
0028 }
0029
0030 explicit FunctionGradient(const MnAlgebraicVector &grd)
0031 : fPtr{new Data{grd, MnAlgebraicVector(0), MnAlgebraicVector(0), true, true, false}}
0032 {
0033 }
0034
0035 FunctionGradient(const MnAlgebraicVector &grd, const MnAlgebraicVector &g2)
0036 : fPtr{new Data{grd, g2, MnAlgebraicVector(0), true, true, true}}
0037 {
0038 }
0039
0040
0041 FunctionGradient(const MnAlgebraicVector &grd, const MnAlgebraicVector &g2, const MnAlgebraicVector &gstep)
0042 : fPtr{new Data{grd, g2, gstep, true, false, true}}
0043 {
0044 }
0045
0046 const MnAlgebraicVector &Grad() const { return fPtr->fGradient; }
0047 const MnAlgebraicVector &Vec() const { return Grad(); }
0048 bool IsValid() const { return fPtr->fValid; }
0049 bool IsAnalytical() const { return fPtr->fAnalytical; }
0050 bool HasG2() const { return fPtr->fHasG2; }
0051 const MnAlgebraicVector &G2() const { return fPtr->fG2ndDerivative; }
0052 const MnAlgebraicVector &Gstep() const { return fPtr->fGStepSize; }
0053
0054 private:
0055 struct Data {
0056 MnAlgebraicVector fGradient;
0057 MnAlgebraicVector fG2ndDerivative;
0058 MnAlgebraicVector fGStepSize;
0059 bool fValid;
0060 bool fAnalytical;
0061 bool fHasG2;
0062 };
0063
0064 std::shared_ptr<Data> fPtr;
0065 };
0066
0067 }
0068
0069 }
0070
0071 #endif