86 typedef std::map<Key, size_t>
Dims;
103 template<
class CONTAINER>
110 template<
typename ITERATOR>
127 size_t size()
const {
return values_.size(); }
130 size_t dim(
Key j)
const {
return at(j).rows(); }
140 iterator item = find(j);
142 throw std::out_of_range(
153 const_iterator item = find(j);
155 throw std::out_of_range(
178 iterator
insert(
const std::pair<Key, Vector>& key_value);
184 template<
class... Args>
186 #if ! defined(GTSAM_USE_TBB) || defined (TBB_GREATER_EQUAL_2020) 187 return values_.emplace(std::piecewise_construct, std::forward_as_tuple(j), std::forward_as_tuple(
args...));
189 return values_.insert({
j,
Vector(std::forward<Args>(
args)...)});
210 #ifdef TBB_GREATER_EQUAL_2020 211 return values_.emplace(j, value);
213 return values_.insert({
j, value});
220 if (!tryInsert(j, value).second) {
228 throw std::invalid_argument(
"Requested variable '" +
230 "', is not in this VectorValues.");
236 iterator
begin() {
return values_.begin(); }
237 const_iterator
begin()
const {
return values_.begin(); }
238 iterator
end() {
return values_.end(); }
239 const_iterator
end()
const {
return values_.end(); }
251 const_iterator
find(
Key j)
const {
return values_.find(j); }
257 void print(
const std::string&
str =
"VectorValues",
271 template <
typename CONTAINER>
275 items.reserve(keys.end() - keys.begin());
278 totalDim += v->size();
284 for (
const Vector*
v : items) {
285 result.segment(pos,
v->size()) = *
v;
293 Vector vector(
const Dims& dims)
const;
314 double squaredNorm()
const;
371 #ifdef GTSAM_ENABLE_BOOST_SERIALIZATION 373 friend class boost::serialization::access;
374 template<
class ARCHIVE>
375 void serialize(ARCHIVE & ar,
const unsigned int ) {
376 ar & BOOST_SERIALIZATION_NVP(values_);
void print(const Matrix &A, const string &s, ostream &stream)
const gtsam::Symbol key('X', 0)
const_iterator begin() const
Iterator over variables.
iterator insert(Key j, const Vector &value)
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 & operator+=(bfloat16 &a, const bfloat16 &b)
VectorValues(const CONTAINER &c)
std::shared_ptr< This > shared_ptr
shared_ptr to this class
std::ostream & operator<<(std::ostream &os, const Dih6 &m)
Values::iterator iterator
Iterator over vector values.
double dot(const V1 &a, const V2 &b)
const_iterator find(Key j) const
std::string serialize(const T &input)
serializes to a string
Vector & operator[](Key j)
std::vector< T, typename internal::FastDefaultVectorAllocator< T >::type > FastVector
Values::value_type value_type
Typedef to pair<Key, Vector>
iterator end()
Iterator over variables.
std::map< Key, size_t > Dims
Keyed vector dimensions.
Point2 operator*(double s, const Point2 &p)
multiply with scalar
static const KeyFormatter DefaultKeyFormatter
static const symbolic::SymbolExpr< internal::symbolic_last_tag > last
ptrdiff_t DenseIndex
The index type for Eigen objects.
const KeyFormatter & formatter
std::pair< iterator, bool > tryInsert(Key j, const Vector &value)
Included from all GTSAM files.
Vector vector(const CONTAINER &keys) const
std::pair< VectorValues::iterator, bool > emplace(Key j, Args &&... args)
const Vector & operator[](Key j) const
ConcurrentMap< Key, Vector > Values
Collection of Vectors making up a VectorValues.
int EIGEN_BLAS_FUNC() swap(int *n, RealScalar *px, int *incx, RealScalar *py, int *incy)
string html(const DiscreteValues &values, const KeyFormatter &keyFormatter, const DiscreteValues::Names &names)
Free version of html.
VectorValues()
Default constructor creates an empty VectorValues.
void insert_or_assign(Key j, const Vector &value)
Array< int, Dynamic, 1 > v
VectorValues(ITERATOR first, ITERATOR last)
Values values_
Vectors making up this VectorValues.
Errors operator+(const Errors &a, const Errors &b)
Addition.
Errors operator-(const Errors &a, const Errors &b)
Subtraction.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
value_type KeyValuePair
Typedef to pair<Key, Vector>
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.
Maps global variable indices to slot indices.
VectorValues(const VectorValues &c)
A thin wrapper around std::vector that uses a custom allocator.
typedef and functions to augment Eigen's VectorXd
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bfloat16 & operator*=(bfloat16 &a, const bfloat16 &b)
void unsafe_erase(typename Base::iterator position)
VectorValues(std::initializer_list< std::pair< Key, Vector >> init)
Construct from initializer list.
static double scale(double x, double a, double b, double t1, double t2)
Scale x from [a, b] to [t1, t2].
static EIGEN_DEPRECATED const end_t end
const_iterator end() const
Iterator over variables.
graph add(PriorFactor< Pose2 >(1, priorMean, priorNoise))
const Vector & at(Key j) const
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
iterator begin()
Iterator over variables.
std::uint64_t Key
Integer nonlinear key type.