52 using std::map<L, size_t>::operator=;
61 void print(
const std::string&
s =
"Assignment: ",
62 const std::function<std::string(
L)>& labelFormatter =
64 std::cout <<
s <<
": ";
65 for (
const typename Assignment::value_type& keyValue : *
this) {
66 std::cout <<
"(" << labelFormatter(keyValue.first) <<
", " 67 << keyValue.second <<
")";
69 std::cout << std::endl;
73 return (*
this == other);
88 template <
typename Derived = Assignment<L>>
89 static std::vector<Derived> CartesianProduct(
90 const std::vector<std::pair<L, size_t>>&
keys) {
91 std::vector<Derived> allPossValues;
94 for (
const DiscreteKey&
key :
keys)
95 values[
key.first] = 0;
97 allPossValues.push_back(values);
99 for (j = 0; j < keys.size(); j++) {
100 L idx = keys[
j].first;
102 if (values[idx] < keys[j].second)
break;
106 if (j == keys.size())
break;
108 return allPossValues;
void print(const Matrix &A, const string &s, ostream &stream)
const gtsam::Symbol key('X', 0)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static std::stringstream ss
Assignment(std::initializer_list< std::pair< const L, size_t >> init)
std::pair< Key, size_t > DiscreteKey
static std::string DefaultFormatter(const L &x)
Default method used by labelFormatter or valueFormatter when printing.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x