49 ALWAYS_ASSERT_EQUAL(target.size(), location->size(),
"target size {} differs from location size {}");
59 Eigen::Ref<DenseRealVector> gradient,
60 Eigen::Ref<DenseRealVector> pre) {
68 ALWAYS_ASSERT_EQUAL(pre.size(), location->size(),
"pre size {} differs from location size {}");
76 Eigen::Ref<DenseRealVector> gradient,
77 Eigen::Ref<DenseRealVector> pre) {
102 ALWAYS_ASSERT_EQUAL(target.size(), location->size(),
"target size {} differs from location size {}");
110 Eigen::Ref<DenseRealVector> target) {
117 ALWAYS_ASSERT_EQUAL(target.size(), location->size(),
"target size {} differs from location size {}");
118 ALWAYS_ASSERT_EQUAL(direction.size(), location->size(),
"direction size {} differs from location size {}");
130 ALWAYS_ASSERT_EQUAL(direction.size(), location->size(),
"direction size {} differs from location size {}");
An Eigen vector with versioning information, to implement simple caching of results.
virtual void gradient_and_pre_conditioner_unchecked(const HashVector &location, Eigen::Ref< DenseRealVector > gradient, Eigen::Ref< DenseRealVector > pre)
virtual void gradient_at_zero_unchecked(Eigen::Ref< DenseRealVector > target)
void hessian_times_direction(const HashVector &location, const DenseRealVector &direction, Eigen::Ref< DenseRealVector > target)
Calculates the product of the Hessian matrix at location with direction.
void gradient_at_zero(Eigen::Ref< DenseRealVector > target)
Gets the gradient for location zero.
virtual void gradient_unchecked(const HashVector &location, Eigen::Ref< DenseRealVector > target)=0
virtual long num_variables() const noexcept=0
void gradient(const HashVector &location, Eigen::Ref< DenseRealVector > target)
Evaluate the gradient at location.
virtual real_t value_unchecked(const HashVector &location)=0
virtual void hessian_times_direction_unchecked(const HashVector &location, const DenseRealVector &direction, Eigen::Ref< DenseRealVector > target)=0
virtual void diag_preconditioner_unchecked(const HashVector &location, Eigen::Ref< DenseRealVector > target)
virtual void project_to_line_unchecked(const HashVector &location, const DenseRealVector &direction)=0
void gradient_and_pre_conditioner(const HashVector &location, Eigen::Ref< DenseRealVector > gradient, Eigen::Ref< DenseRealVector > pre)
Combines the calculation of gradient and pre-conditioner, which may be more efficient in some cases.
void project_to_line(const HashVector &location, const DenseRealVector &direction)
creates a function g such that g(a) = objective(location + a * direction) Use lookup_on_line() to eva...
void diag_preconditioner(const HashVector &location, Eigen::Ref< DenseRealVector > target)
Get precondition to be used in CG optimization.
real_t value(const HashVector &location)
Evaluate the objective at the given location.
auto make_timer(stat_id_t id, Args... args)
Creates a new ScopeTimer using stats::record_scope_time.
void declare_stat(stat_id_t index, StatisticMetaData meta)
Declares a new statistics. This function just forwards all its arguments to the internal StatisticsCo...
constexpr const stats::stat_id_t STAT_PERF_PRECONDITIONER
constexpr const stats::stat_id_t STAT_PERF_GRAD_AT_ZERO
constexpr const stats::stat_id_t STAT_PERF_HESSIAN
constexpr const stats::stat_id_t STAT_PERF_VALUE
constexpr const stats::stat_id_t STAT_PERF_GRADIENT
constexpr const stats::stat_id_t STAT_PERF_GRAD_AND_PRE
constexpr const stats::stat_id_t STAT_PERF_PROJ_TO_LINE
Main namespace in which all types, classes, and functions are defined.
types::DenseVector< real_t > DenseRealVector
Any dense, real values vector.
float real_t
The default type for floating point values.
#define ALWAYS_ASSERT_EQUAL(x, y, msg)