GaussianDensity.cpp
Go to the documentation of this file.
1 /* ----------------------------------------------------------------------------
2 
3  * GTSAM Copyright 2010, Georgia Tech Research Corporation,
4  * Atlanta, Georgia 30332-0415
5  * All Rights Reserved
6  * Authors: Frank Dellaert, et al. (see THANKS for the full author list)
7 
8  * See LICENSE for the license information
9 
10  * -------------------------------------------------------------------------- */
11 
20 #include <string>
21 
22 using std::cout;
23 using std::endl;
24 using std::string;
25 
26 namespace gtsam {
27 
28 /* ************************************************************************* */
30  double sigma) {
31  return GaussianDensity(key, mean, Matrix::Identity(mean.size(), mean.size()),
32  noiseModel::Isotropic::Sigma(mean.size(), sigma));
33 }
34 
35 /* ************************************************************************* */
36 void GaussianDensity::print(const string& s,
37  const KeyFormatter& formatter) const {
38  cout << s << ": density on ";
39  for (const_iterator it = beginFrontals(); it != endFrontals(); ++it) {
40  cout << "[" << formatter(*it) << "] ";
41  }
42  cout << endl;
43  gtsam::print(mean(), "mean: ");
44  gtsam::print(covariance(), "covariance: ");
45  if (model_) model_->print("Noise model: ");
46 }
47 
48 /* ************************************************************************* */
50  VectorValues soln = this->solve(VectorValues());
51  return soln[firstFrontalKey()];
52 }
53 
54 /* ************************************************************************* */
55 Matrix GaussianDensity::covariance() const { return information().inverse(); }
56 
57 } // namespace gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
const gtsam::Symbol key('X', 0)
JacobianFactor ::const_iterator endFrontals() const
Definition: Conditional.h:182
void print(const std::string &="GaussianDensity", const KeyFormatter &formatter=DefaultKeyFormatter) const override
print
noiseModel::Diagonal::shared_ptr model_
VectorValues solve(const VectorValues &parents) const
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:39
Matrix information() const override
Point3 mean(const CONTAINER &points)
mean
Definition: Point3.h:70
const KeyFormatter & formatter
JacobianFactor ::const_iterator beginFrontals() const
Definition: Conditional.h:179
A Gaussian Density.
Eigen::VectorXd Vector
Definition: Vector.h:38
GaussianDensity()
default constructor needed for serialization
static GaussianDensity FromMeanAndStddev(Key key, const Vector &mean, double sigma)
Construct using a mean and standard deviation.
RealScalar s
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
Vector mean() const
Mean .
traits
Definition: chartTesting.h:28
static const double sigma
KeyVector::const_iterator const_iterator
Const iterator over keys.
Definition: Factor.h:82
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:102
static shared_ptr Sigma(size_t dim, double sigma, bool smart=true)
Definition: NoiseModel.cpp:594
Matrix covariance() const
Covariance matrix .


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:15