Skip to content

Commit

Permalink
Restore and deprecate getInfo for backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
lballabio committed Oct 3, 2024
1 parent 8c64bf0 commit 0e4c3df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ql/math/optimization/levenbergmarquardt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ namespace QuantLib {
wa1.get(), wa2.get(), wa3.get(), wa4.get(),
lmdifCostFunction,
lmdifJacFunction);
// for the time being
info_ = info;
// check requirements & endCriteria evaluation
QL_REQUIRE(info != 0, "MINPACK: improper input parameters");
QL_REQUIRE(info != 7, "MINPACK: xtol is too small. no further "
Expand Down
7 changes: 7 additions & 0 deletions ql/math/optimization/levenbergmarquardt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ namespace QuantLib {
bool useCostFunctionsJacobian = false);
EndCriteria::Type minimize(Problem& P,
const EndCriteria& endCriteria) override;

void fcn(int m,
int n,
Real* x,
Expand All @@ -65,10 +66,16 @@ namespace QuantLib {
Real* fjac,
int* iflag);

/*! \deprecated Don't use this method; inspect the result of minimize instead.
Deprecated in version 1.36.
*/
[[deprecated("Don't use this method; inspect the result of minimize instead")]]
virtual Integer getInfo() const { return info_; }
private:
Problem* currentProblem_;
Array initCostValues_;
Matrix initJacobian_;
mutable Integer info_ = 0; // remove together with getInfo
const Real epsfcn_, xtol_, gtol_;
const bool useCostFunctionsJacobian_;
};
Expand Down

0 comments on commit 0e4c3df

Please sign in to comment.