Autoware.Auto
autoware::common::optimization::CacheStateMachine< DomainValue, ComparatorT > Class Template Reference

#include <utils.hpp>

Public Member Functions

 CacheStateMachine (const ComparatorT &comparator=ComparatorT())
 
 CacheStateMachine (const DomainValue &value, const ComputeMode &mode, const ComparatorT &comparator=ComparatorT())
 
void update (const DomainValue &value, const ComputeMode &mode) noexcept
 
bool8_t is_cached (const DomainValue &x, const ExpressionTerm &term) const noexcept
 

Detailed Description

template<typename DomainValue, typename ComparatorT = decltype(std::equal_to<DomainValue>())>
class autoware::common::optimization::CacheStateMachine< DomainValue, ComparatorT >

State machine to keep track of the cache state of an expression

Template Parameters
DomainValueValue type
ComparatorTEquality comparison functor for DomainValue

Constructor & Destructor Documentation

◆ CacheStateMachine() [1/2]

template<typename DomainValue , typename ComparatorT = decltype(std::equal_to<DomainValue>())>
autoware::common::optimization::CacheStateMachine< DomainValue, ComparatorT >::CacheStateMachine ( const ComparatorT &  comparator = ComparatorT())
inlineexplicit

Constructor

Parameters
comparatorEquality comparison functor object.

◆ CacheStateMachine() [2/2]

template<typename DomainValue , typename ComparatorT = decltype(std::equal_to<DomainValue>())>
autoware::common::optimization::CacheStateMachine< DomainValue, ComparatorT >::CacheStateMachine ( const DomainValue &  value,
const ComputeMode mode,
const ComparatorT &  comparator = ComparatorT() 
)
inline

Constructor with initial values.

Parameters
valueInitial value
modeInitial mode
comparatorEquality comparison functor object.

Member Function Documentation

◆ is_cached()

template<typename DomainValue , typename ComparatorT = decltype(std::equal_to<DomainValue>())>
bool8_t autoware::common::optimization::CacheStateMachine< DomainValue, ComparatorT >::is_cached ( const DomainValue &  x,
const ExpressionTerm term 
) const
inlinenoexcept

Check if the term is already evaluated and cached for a given parameter

Parameters
xParameter value
termExpression term to query the cache status. Can be one of the following: SCORE, JACOBIAN, HESSIAN
Returns
True if the result for this term with the given parameter matches the previous state and is already cached.

◆ update()

template<typename DomainValue , typename ComparatorT = decltype(std::equal_to<DomainValue>())>
void autoware::common::optimization::CacheStateMachine< DomainValue, ComparatorT >::update ( const DomainValue &  value,
const ComputeMode mode 
)
inlinenoexcept

Update the state with the given parameter and the computation mode/

Parameters
valueParameter value used in computation
modeComputation mode

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