Infrared
Loading...
Searching...
No Matches
ired::MaterializedFunction< FunValue, ContainerS > Class Template Reference

A materialized function. More...

#include <functions.hpp>

Inheritance diagram for ired::MaterializedFunction< FunValue, ContainerS >:
Collaboration diagram for ired::MaterializedFunction< FunValue, ContainerS >:

Public Types

using self_t = MaterializedFunction< FunValue, ContainerS >
 
using parent_t = Function< FunValue >
 
using base_t = typename parent_t::base_t
 
using var_idx_t = typename parent_t::var_idx_t
 
using assignment_t = typename parent_t::assignment_t
 
using fun_value_t = FunValue
 
using function_t = Function< fun_value_t >
 
using data_t = typename container_selector< FunValue, ContainerS >::type
 
- Public Types inherited from ired::Function< FunValue >
using self_t = Function< FunValue >
 
using base_t = self_t
 
using assignment_t = Assignment
 
using fun_value_t = FunValue
 
- Public Types inherited from ired::Dependency
using var_idx_t = int
 

Public Member Functions

template<class FeatureNetwork >
 MaterializedFunction (const std::vector< var_idx_t > &vars, const FeatureNetwork &cn)
 construct 'empty' with variables, domains, and zero value
 
template<class FeatureNetwork >
 MaterializedFunction (const function_t *function, const FeatureNetwork &cn)
 materializing constructor
 
fun_value_t operator() (const assignment_t &a) const override
 evaluate function
 
void set (const assignment_t &a, const fun_value_t &val)
 set function value
 
bool guaranteed_zero (const assignment_t &a) const override
 check whether this object knows that some function value is zero
 
virtual bool auto_materialize () const override
 whether to automatically materialize when added to CN
 
virtual std::string name () const override
 name of the class
 
auto datasize () const
 number of stored function values
 
- Public Member Functions inherited from ired::Function< FunValue >
 Function (const std::vector< var_idx_t > &vars)
 
virtual fun_value_t operator() (const assignment_t &) const=0
 
virtual bool guaranteed_zero (const assignment_t &a) const
 
virtual bool auto_materialize () const
 
virtual std::string name () const
 
virtual ~Function ()
 
- Public Member Functions inherited from ired::Dependency
 Dependency (const std::vector< var_idx_t > &vars)
 
const std::vector< var_idx_t > & vars () const
 
virtual ~Dependency ()
 

Detailed Description

template<class FunValue, class ContainerS = simple_mapS>
class ired::MaterializedFunction< FunValue, ContainerS >

A materialized function.

A function that holds a table of function values. It is used to represent computed messages (DP matrices) during evaluation of the cluster tree, or precomputed functions.

Supports sparse and non-sparse representation of the function value table. The choice is made by a template mechanism using selector classes.

Member Typedef Documentation

◆ assignment_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::assignment_t = typename parent_t::assignment_t

◆ base_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::base_t = typename parent_t::base_t

◆ data_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::data_t = typename container_selector<FunValue,ContainerS>::type

◆ fun_value_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::fun_value_t = FunValue

◆ function_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::function_t = Function<fun_value_t>

◆ parent_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::parent_t = Function<FunValue>

◆ self_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::self_t = MaterializedFunction<FunValue,ContainerS>

◆ var_idx_t

template<class FunValue , class ContainerS = simple_mapS>
using ired::MaterializedFunction< FunValue, ContainerS >::var_idx_t = typename parent_t::var_idx_t

Constructor & Destructor Documentation

◆ MaterializedFunction() [1/2]

template<class FunValue , class ContainerS = simple_mapS>
template<class FeatureNetwork >
ired::MaterializedFunction< FunValue, ContainerS >::MaterializedFunction ( const std::vector< var_idx_t > &  vars,
const FeatureNetwork cn 
)
inline

construct 'empty' with variables, domains, and zero value

Parameters
varsvector of indices of variable in a cn
domainsdomains of the variables in the cn
zerovalue (default for not explicitly set function values)

The (non-zero) function values are typically set after construction, using method

See also
set()

◆ MaterializedFunction() [2/2]

template<class FunValue , class ContainerS = simple_mapS>
template<class FeatureNetwork >
ired::MaterializedFunction< FunValue, ContainerS >::MaterializedFunction ( const function_t function,
const FeatureNetwork cn 
)
inline

materializing constructor

copy constructs from function, thereby materializing it

Parameters
functionthe function to be copied
cnconstraint network (must outlive this object)
evaluationpolicy

Member Function Documentation

◆ auto_materialize()

template<class FunValue , class ContainerS = simple_mapS>
virtual bool ired::MaterializedFunction< FunValue, ContainerS >::auto_materialize ( ) const
inlineoverridevirtual

whether to automatically materialize when added to CN

Reimplemented from ired::Function< FunValue >.

◆ datasize()

template<class FunValue , class ContainerS = simple_mapS>
auto ired::MaterializedFunction< FunValue, ContainerS >::datasize ( ) const
inline

number of stored function values

◆ guaranteed_zero()

template<class FunValue , class ContainerS = simple_mapS>
bool ired::MaterializedFunction< FunValue, ContainerS >::guaranteed_zero ( const assignment_t a) const
inlineoverridevirtual

check whether this object knows that some function value is zero

Parameters
aassignment where this is checked

Reimplemented from ired::Function< FunValue >.

◆ name()

template<class FunValue , class ContainerS = simple_mapS>
virtual std::string ired::MaterializedFunction< FunValue, ContainerS >::name ( ) const
inlineoverridevirtual

name of the class

Reimplemented from ired::Function< FunValue >.

◆ operator()()

template<class FunValue , class ContainerS = simple_mapS>
fun_value_t ired::MaterializedFunction< FunValue, ContainerS >::operator() ( const assignment_t a) const
inlineoverridevirtual

evaluate function

Parameters
aassignment where the function is evaluated

Implements ired::Function< FunValue >.

◆ set()

template<class FunValue , class ContainerS = simple_mapS>
void ired::MaterializedFunction< FunValue, ContainerS >::set ( const assignment_t a,
const fun_value_t val 
)
inline

set function value

Parameters
aassignment where the value is set
valuevalue to be set

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