47 for (
const auto &kv : init)
55 if (it != delta.
end()) {
67 cout << str << (str.empty() ?
"" :
"\n");
68 cout <<
"Values with " <<
size() <<
" values:\n";
70 cout <<
"Value " << keyFormatter(
key) <<
": ";
81 it1 !=
values_.end(); ++it1, ++it2) {
82 const Value* value1 = it1->second.get();
83 const Value* value2 = it2->second.get();
84 if (
typeid(*value1) !=
typeid(*value2) || it1->first != it2->first
85 || !value1->
equals_(*value2, tol)) {
99 return Values(*
this, delta);
105 assert(this->
size() == delta.
size());
106 auto key_value =
values_.begin();
109 for (; key_value !=
values_.end(); ++key_value) {
110 key_delta = delta.
find(key_value->first);
112 for (key_delta = delta.
begin(); key_value !=
values_.end();
113 ++key_value, ++key_delta) {
114 assert(key_value->first == key_delta->first);
116 Key var = key_value->first;
117 assert(static_cast<size_t>(delta[var].
size()) == key_value->second->dim());
118 assert(delta[var].allFinite());
122 *(key_value->second) = *retracted;
134 it1 !=
values_.end(); ++it1, ++it2) {
135 if(it1->first != it2->first)
139 result.
insert(it1->first, it1->second->localCoordinates_(*it2->second));
146 KeyValueMap::const_iterator it =
values_.find(j);
157 if(!insertResult.second)
171 KeyValueMap::iterator it =
values_.find(j);
176 const Value& old_value = *it->second;
177 if (
typeid(old_value) !=
typeid(val))
211 KeyValueMap::iterator it =
values_.find(j);
220 result.reserve(
size());
222 result.push_back(
key);
245 result +=
value->dim();
252 std::map<Key,size_t>
result;
271 "Attempting to add a key-value pair with key \"" +
DefaultKeyFormatter(key_) +
"\", key already exists.";
272 return message_.c_str();
279 "Attempting to " + std::string(operation_) +
" the key \"" +
281 return message_.c_str();
286 if(message_.empty()) {
287 std::string storedTypeName =
demangle(storedTypeId_.name());
288 std::string requestedTypeName =
demangle(requestedTypeId_.name());
290 if (storedTypeName == requestedTypeName) {
291 message_ =
"WARNING: Detected types with same name but different `typeid`. \ 292 This is usually caused by incorrect linking/inlining settings when compiling libraries using GTSAM. \ 293 If you are a user, please report to the author of the library using GTSAM. \ 294 If you are a package maintainer, please consult `cmake/GtsamPybindWrap.cmake`, line 74 for details.";
297 "Attempting to retrieve value with key \"" +
DefaultKeyFormatter(key_) +
"\", type stored in Values is " +
298 storedTypeName +
" but requested type was " + requestedTypeName;
301 return message_.c_str();
306 if(message_.empty()) {
309 <<
"Attempting to retrieve fixed-size matrix with dimensions " 311 <<
", but found dynamic Matrix with mismatched dimensions " 312 << M2_ <<
"x" << N2_;
313 message_ = oss.str();
315 return message_.c_str();
virtual bool equals_(const Value &other, double tol=1e-9) const =0
const gtsam::Symbol key('X', 0)
GTSAM_EXPORT const char * what() const noexcept override
The message to be displayed to the user.
A non-templated config holding any types of Manifold-group elements.
const ValueType at(Key j) const
virtual Value * clone_() const =0
bool exists(const VALUE &e) const
void update(Key j, const Value &val)
iterator insert(const std::pair< Key, Vector > &key_value)
virtual void deallocate_() const =0
iterator end()
Iterator over variables.
virtual Value * retract_(const Vector &delta) const =0
VectorValues localCoordinates(const Values &cp) const
static const KeyFormatter DefaultKeyFormatter
Values retract(const VectorValues &delta) const
detail::enable_if_t<!detail::move_never< T >::value, T > move(object &&obj)
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
VectorValues zeroVectors() const
Array< int, Dynamic, 1 > v
Values & operator=(const Values &rhs)
void retractMasked(const VectorValues &delta, const KeySet &mask)
std::map< Key, size_t > dims() const
bool equals(const Values &other, double tol=1e-9) const
Values::const_iterator const_iterator
Const iterator over vector values.
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
GTSAM_EXPORT const char * what() const noexcept override
std::vector< float > Values
void insert_or_assign(Key j, const Value &val)
If key j exists, update value, else perform an insert.
std::string demangle(const char *name)
Pretty print Value type name.
void insert(Key j, const Value &val)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
iterator begin()
Iterator over variables.
std::uint64_t Key
Integer nonlinear key type.
GTSAM_EXPORT const char * what() const noexcept override
The message to be displayed to the user.
GTSAM_EXPORT const char * what() const noexcept override
The message to be displayed to the user.