Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
gtsam::Assignment< L > Class Template Reference

#include <Assignment.h>

Inheritance diagram for gtsam::Assignment< L >:
Inheritance graph
[legend]

Public Member Functions

 Assignment ()=default
 
 Assignment (std::initializer_list< std::pair< const L, size_t >> init)
 
bool equals (const Assignment &other, double tol=1e-9) const
 
void print (const std::string &s="Assignment: ", const std::function< std::string(L)> &labelFormatter=&DefaultFormatter) const
 

Static Public Member Functions

template<typename Derived = Assignment<L>>
static std::vector< Derived > CartesianProduct (const std::vector< std::pair< L, size_t >> &keys)
 Get Cartesian product consisting all possible configurations. More...
 

Static Private Member Functions

static std::string DefaultFormatter (const L &x)
 Default method used by labelFormatter or valueFormatter when printing. More...
 

Detailed Description

template<class L>
class gtsam::Assignment< L >

An assignment from labels to value index (size_t). Assigns to each label a value. Implemented as a simple map. A discrete factor takes an Assignment and returns a value.

Definition at line 37 of file Assignment.h.

Constructor & Destructor Documentation

◆ Assignment() [1/2]

template<class L >
gtsam::Assignment< L >::Assignment ( )
default

◆ Assignment() [2/2]

template<class L >
gtsam::Assignment< L >::Assignment ( std::initializer_list< std::pair< const L, size_t >>  init)
inline

Definition at line 58 of file Assignment.h.

Member Function Documentation

◆ CartesianProduct()

template<class L >
template<typename Derived = Assignment<L>>
static std::vector<Derived> gtsam::Assignment< L >::CartesianProduct ( const std::vector< std::pair< L, size_t >> &  keys)
inlinestatic

Get Cartesian product consisting all possible configurations.

Parameters
vectorlist of keys (label,cardinality) pairs.
Returns
vector list of all possible value assignments

This function returns a vector of Assignment values for all possible (Cartesian product) configurations of set of Keys which are nothing but (Label,cardinality) pairs. This function should NOT be called for more than a small number of variables and cardinalities. E.g. For 6 variables with each having cardinalities 4, we get 4096 possible configurations!!

Definition at line 89 of file Assignment.h.

◆ DefaultFormatter()

template<class L >
static std::string gtsam::Assignment< L >::DefaultFormatter ( const L x)
inlinestaticprivate

Default method used by labelFormatter or valueFormatter when printing.

Parameters
xThe value passed to format.
Returns
std::string

Definition at line 45 of file Assignment.h.

◆ equals()

template<class L >
bool gtsam::Assignment< L >::equals ( const Assignment< L > &  other,
double  tol = 1e-9 
) const
inline

Definition at line 72 of file Assignment.h.

◆ print()

template<class L >
void gtsam::Assignment< L >::print ( const std::string &  s = "Assignment< L >: ",
const std::function< std::string(L)> &  labelFormatter = &DefaultFormatter 
) const
inline

Definition at line 61 of file Assignment.h.


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


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:23:31