This evaluation policy uses previously cached results when possible. More...

#include <Cached.h>

Inheritance diagram for MEAL::Cached< T >:
MEAL::CalculatePolicy< T > MEAL::EvaluationPolicy< T::Result > MEAL::FunctionPolicy Reference::Able Reference::HeapTracked

Public Types

typedef T::Result Result
 

Public Member Functions

 Cached (T *context)
 Default constructor.
 
Result evaluate (std::vector< Result > *gradient=0) const
 Implement the evaluate method of the Function.
 
std::string class_name () const
 Return the name of the class for debugging.
 
- Public Member Functions inherited from MEAL::CalculatePolicy< T >
 CalculatePolicy (T *context)
 Default destructor.
 
void calculate (Result &r, std::vector< Result > *grad) const
 
- Public Member Functions inherited from MEAL::EvaluationPolicy< T::Result >
 EvaluationPolicy (Function *context)
 Default destructor.
 
- Public Member Functions inherited from MEAL::FunctionPolicy
 FunctionPolicy (Function *context=0)
 Default constructor.
 
 ~FunctionPolicy ()
 Destructor. More...
 
Functionget_context () const
 Return the Function for whom this policy operates.
 
- Public Member Functions inherited from Reference::Able
 Able (const Able &)
 
Ableoperator= (const Able &)
 
unsigned get_reference_count () const
 
- Public Member Functions inherited from Reference::HeapTracked
 HeapTracked (const HeapTracked &)
 
HeapTrackedoperator= (const HeapTracked &)
 
bool __is_on_heap () const
 

Protected Member Functions

void update (bool need_gradient) const
 Updates the result (and gradient when needed)
 
void update (bool need_gradient)
 
- Protected Member Functions inherited from Reference::Able
Handle__reference (bool active) const
 
void __dereference (bool auto_delete=true) const
 

Protected Attributes

Result cached_result
 The result cached in the last call to calculate.
 
std::vector< Result > cached_gradient
 The gradient cached in the last call to calculate.
 
- Protected Attributes inherited from MEAL::CalculatePolicy< T >
T * calculate_context
 The object that implements a calculate method.
 

Additional Inherited Members

- Static Public Member Functions inherited from Reference::Able
static size_t get_instance_count ()
 
- Static Public Member Functions inherited from Reference::HeapTracked
static void * operator new (size_t size, void *ptr=0)
 
static void operator delete (void *location, void *ptr)
 
static void operator delete (void *location)
 
static size_t get_heap_queue_size ()
 

Detailed Description

template<class T>
class MEAL::Cached< T >

This evaluation policy uses previously cached results when possible.

This class re-computes the cached values of the result and gradient only if the context has been altered.


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

Generated using doxygen 1.8.17