DiSMEC++
anonymous_namespace{minimizer.cpp}::MockObjective Struct Reference

An objective to be used in test cases. Does not do any computations, but just resturns constants. More...

Inheritance diagram for anonymous_namespace{minimizer.cpp}::MockObjective:
dismec::objective::Objective dismec::stats::Tracked

Public Member Functions

long num_variables () const noexcept override
 
real_t value_unchecked (const HashVector &location) override
 
void gradient_unchecked (const HashVector &location, Eigen::Ref< DenseRealVector > target) override
 
void hessian_times_direction_unchecked (const HashVector &location, const DenseRealVector &direction, Eigen::Ref< DenseRealVector > target) override
 
void project_to_line_unchecked (const HashVector &location, const DenseRealVector &direction) override
 
real_t lookup_on_line (real_t position) override
 Looks up the value of the objective on the line defined by the last call to project_to_line(). More...
 
- Public Member Functions inherited from dismec::objective::Objective
 Objective ()
 
virtual ~Objective () noexcept=default
 
real_t value (const HashVector &location)
 Evaluate the objective at the given location. More...
 
void diag_preconditioner (const HashVector &location, Eigen::Ref< DenseRealVector > target)
 Get precondition to be used in CG optimization. More...
 
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 evaluate g. More...
 
virtual void declare_vector_on_last_line (const HashVector &location, real_t t)
 State that the given vector corresponds to a certain position on the line of the last line search. More...
 
void gradient_at_zero (Eigen::Ref< DenseRealVector > target)
 Gets the gradient for location zero. More...
 
void gradient (const HashVector &location, Eigen::Ref< DenseRealVector > target)
 Evaluate the gradient at location. More...
 
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. More...
 
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. More...
 
- Public Member Functions inherited from dismec::stats::Tracked
 Tracked ()
 Default constructor, creates the internal stats::StatisticsCollection. More...
 
void register_stat (const std::string &name, std::unique_ptr< Statistics > stat)
 Registers a tracker for the statistics name. More...
 
std::shared_ptr< StatisticsCollectionget_stats () const
 Gets an ownership-sharing reference to the StatisticsCollection. More...
 

Additional Inherited Members

- Protected Member Functions inherited from dismec::stats::Tracked
 ~Tracked ()
 Non-virtual destructor. Declared protected, so we don't accidentally try to do a polymorphic delete. More...
 
template<class T >
void record (stat_id_t stat, T &&value)
 Record statistics. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
void declare_stat (stat_id_t index, StatisticMetaData meta)
 Declares a new statistics. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
void declare_tag (tag_id_t index, std::string name)
 Declares a new tag. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
template<class... Args>
void set_tag (tag_id_t tag, long value)
 Set value of tag. This function just forwards all its arguments to the internal StatisticsCollection. More...
 
template<class... Args>
auto make_timer (stat_id_t id, Args... args)
 Creates a new ScopeTimer using stats::record_scope_time. More...
 

Detailed Description

An objective to be used in test cases. Does not do any computations, but just resturns constants.

Definition at line 59 of file minimizer.cpp.

Member Function Documentation

◆ gradient_unchecked()

void anonymous_namespace{minimizer.cpp}::MockObjective::gradient_unchecked ( const HashVector location,
Eigen::Ref< DenseRealVector target 
)
inlineoverridevirtual

The function that does the actual gradient computation. This is called in gradient() after the arguments have been validated.

Implements dismec::objective::Objective.

Definition at line 62 of file minimizer.cpp.

◆ hessian_times_direction_unchecked()

void anonymous_namespace{minimizer.cpp}::MockObjective::hessian_times_direction_unchecked ( const HashVector location,
const DenseRealVector direction,
Eigen::Ref< DenseRealVector target 
)
inlineoverridevirtual

The function that does the actual computation. This is called in hessian_times_direction() after the arguments have been validated.

Implements dismec::objective::Objective.

Definition at line 63 of file minimizer.cpp.

◆ lookup_on_line()

real_t anonymous_namespace{minimizer.cpp}::MockObjective::lookup_on_line ( real_t  position)
inlineoverridevirtual

Looks up the value of the objective on the line defined by the last call to project_to_line().

Parameters
positionThe location where the objective is calculated.
Returns
The value of objective(location + position * direction), where location and direction are the vectors passed to the last call of project_to_line().
Attention
This function may use results cached project_to_line(), so it has to be called after a call to that function. A new call to project_to_line() will change the line which is evaluated.

Implements dismec::objective::Objective.

Definition at line 66 of file minimizer.cpp.

◆ num_variables()

long anonymous_namespace{minimizer.cpp}::MockObjective::num_variables ( ) const
inlineoverridevirtualnoexcept

Gets the number of variables this objective expects. May return -1 if the objective is agnostic to the number of variables, e.g. for regularizers.

Implements dismec::objective::Objective.

Definition at line 60 of file minimizer.cpp.

◆ project_to_line_unchecked()

void anonymous_namespace{minimizer.cpp}::MockObjective::project_to_line_unchecked ( const HashVector location,
const DenseRealVector direction 
)
inlineoverridevirtual

The function that does the actual computation. This is called in project_to_line() after the arguments have been validated.

Implements dismec::objective::Objective.

Definition at line 65 of file minimizer.cpp.

◆ value_unchecked()

real_t anonymous_namespace{minimizer.cpp}::MockObjective::value_unchecked ( const HashVector location)
inlineoverridevirtual

The function that does the actual value computation. This is called in value() after the argument has been validated.

Implements dismec::objective::Objective.

Definition at line 61 of file minimizer.cpp.


The documentation for this struct was generated from the following file: