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 
21 using namespace std;
22 
23 namespace gtsam {
24 
25  /* ************************************************************************* */
26  GaussianDensity GaussianDensity::FromMeanAndStddev(Key key, const Vector& mean, const double& sigma)
27  {
28  return GaussianDensity(key, mean / sigma, Matrix::Identity(mean.size(), mean.size()) / sigma);
29  }
30 
31  /* ************************************************************************* */
32  void GaussianDensity::print(const string &s, const KeyFormatter& formatter) const
33  {
34  cout << s << ": density on ";
35  for(const_iterator it = beginFrontals(); it != endFrontals(); ++it)
36  cout << (boost::format("[%1%]")%(formatter(*it))).str() << " ";
37  cout << endl;
38  gtsam::print(Matrix(R()), "R: ");
39  gtsam::print(Vector(d()), "d: ");
40  if(model_)
41  model_->print("Noise model: ");
42  }
43 
44  /* ************************************************************************* */
46  VectorValues soln = this->solve(VectorValues());
47  return soln[firstFrontalKey()];
48  }
49 
50  /* ************************************************************************* */
51  Matrix GaussianDensity::covariance() const {
52  return information().inverse();
53  }
54 
55 } // gtsam
void print(const Matrix &A, const string &s, ostream &stream)
Definition: Matrix.cpp:155
static const double sigma
Eigen::MatrixXd Matrix
Definition: base/Matrix.h:43
Rot2 R(Rot2::fromAngle(0.1))
Definition: Half.h:150
Point3 mean(const CONTAINER &points)
mean
Definition: Point3.h:66
const KeyFormatter & formatter
A Gaussian Density.
Eigen::VectorXd Vector
Definition: Vector.h:38
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
RealScalar s
traits
Definition: chartTesting.h:28
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic, Eigen::RowMajor > Matrix
KeyVector::const_iterator const_iterator
Const iterator over keys.
Definition: Factor.h:67
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:61


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:05