Go to the documentation of this file.
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) <<
": ";
80 for (
auto it1 =
values_.begin(), it2 =
other.values_.begin();
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
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);
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
std::map< Key, size_t > dims() const
bool exists(const VALUE &e) const
void retractMasked(const VectorValues &delta, const KeySet &mask)
virtual void deallocate_() const =0
void update(Key j, const Value &val)
FastVector< Key > KeyVector
Define collection type once and for all - also used in wrappers.
VectorValues localCoordinates(const Values &cp) const
KeyFormatter DefaultKeyFormatter
Assign default key formatter.
Values::const_iterator const_iterator
Const iterator over vector values.
const ValueType at(Key j) const
Values retract(const VectorValues &delta) const
virtual Value * clone_() const =0
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
const GTSAM_EXPORT char * what() const noexcept override
The message to be displayed to the user.
bool equals(const Values &other, double tol=1e-9) const
const GTSAM_EXPORT char * what() const noexcept override
const gtsam::Symbol key('X', 0)
VectorValues zeroVectors() const
detail::enable_if_t<!detail::move_never< T >::value, T > move(object &&obj)
std::vector< float > Values
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
const GTSAM_EXPORT char * what() const noexcept override
The message to be displayed to the user.
std::string demangle(const char *name)
Pretty print Value type name.
void insert(Key j, const Value &val)
Array< int, Dynamic, 1 > v
std::uint64_t Key
Integer nonlinear key type.
const GTSAM_EXPORT char * what() const noexcept override
The message to be displayed to the user.
Values & operator=(const Values &rhs)
virtual Value * retract_(const Vector &delta) const =0
A non-templated config holding any types of Manifold-group elements.
void insert_or_assign(Key j, const Value &val)
If key j exists, update value, else perform an insert.
gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:09:41