26Kernel::Logger
g_log(
"DampedGaussNewtonMinimizer");
33 declareProperty(
"Damping", 0.0,
"The damping parameter.");
34 declareProperty(
"Verbose",
false,
"Make output more verbose.");
39 m_leastSquares = std::dynamic_pointer_cast<CostFunctions::CostFuncLeastSquares>(function);
41 throw std::invalid_argument(
"Damped Gauss-Newton minimizer works only with least "
42 "squares. Different function was given.");
52 throw std::runtime_error(
"Cost function isn't set up.");
68 for (
size_t i = 0; i <
n; ++i) {
69 double tmp = H.get(i, i) + damping;
80 for (
size_t j = 0; j <
n; ++j) {
92 }
catch (std::runtime_error &e) {
98 for (
size_t j = 0; j <
n; ++j) {
105 for (
size_t i = 0; i <
n; ++i) {
106 if (!std::isfinite(dx[i])) {
129 throw std::runtime_error(
"Cost function isn't set up.");
#define DECLARE_FUNCMINIMIZER(classname, username)
Macro for declaring a new type of minimizers to be used with the FuncMinimizerFactory.
An interface for function minimizers.
std::string m_errorString
Error string.
A wrapper around Eigen::Matrix.
A wrapper around Eigen::Vector.
double get(const size_t i) const
Get an element.
double norm() const
Get vector norm (length)
Implements a Gauss-Newton minimization algorithm with damping for use with least squares cost functio...
std::shared_ptr< CostFunctions::CostFuncLeastSquares > m_leastSquares
Pointer to the cost function. Must be the least squares.
double m_relTol
Relative tolerance.
bool iterate(size_t) override
Do one iteration.
void initialize(API::ICostFunction_sptr function, size_t maxIterations=0) override
Initialize minimizer, i.e. pass a function to minimize.
double costFunctionVal() override
Return current value of the cost function.
void warning(const std::string &msg)
Logs at warning level.
TypedValue getProperty(const std::string &name) const override
Get the value of a property.
Kernel::Logger g_log("ExperimentInfo")
static logger object
std::shared_ptr< ICostFunction > ICostFunction_sptr
define a shared pointer to a cost function