Loading...
Searching...
No Matches
gtsam::Assignment< L > Class Template Reference
Discrete

## 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.

Inheritance diagram for gtsam::Assignment< L >:

## Public Member Functions

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

## Member Function Documentation

## CartesianProduct()

template<class L>
template<typename Derived = Assignment<L>>

std::vector< Derived > gtsam::Assignment< L >::CartesianProduct | ( | const std::vector< std::pair< L, size_t > > & | keys | ) |

inline static

Get Cartesian product consisting all possible configurations.

Parameters

  vector | list 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!!

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

- /build/gtsam-RkN8wG/gtsam-4.2.2+dfsg/gtsam/discrete/Assignment.h