61 static double f(
double z,
double u,
double p) {
62 return logSqrt2PI - 0.5 *
log(p) + 0.5 * (z - u) * (z - u) *
p;
77 double e = u -
z, e2 = e *
e;
78 double c = 2 * logSqrt2PI -
log(p) + e2 *
p;
97 Base(), z_(z), meanKey_(meanKey), precisionKey_(precisionKey) {
113 void print(
const std::string&
p =
"WhiteNoiseFactor",
116 std::cout <<
p +
".z: " << z_ << std::endl;
124 size_t dim()
const override {
130 return f(z_, x.
at<
double>(meanKey_), x.
at<
double>(precisionKey_));
void print(const std::string &p="WhiteNoiseFactor", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Print.
static double f(double z, double u, double p)
negative log likelihood as a function of mean and precision
static HessianFactor::shared_ptr linearize(double z, double u, double p, Key j1, Key j2)
linearize returns a Hessianfactor that approximates error Hessian is Taylor expansion is So f = 2 f...
std::shared_ptr< This > shared_ptr
A shared_ptr to this class.
const ValueType at(Key j) const
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
EIGEN_DEVICE_FUNC const LogReturnType log() const
static const KeyFormatter DefaultKeyFormatter
const double logSqrt2PI
constant needed below
virtual Vector unwhitenedError(const Values &x) const
~WhiteNoiseFactor() override
Destructor.
Key meanKey_
key by which to access mean variable
double error(const Values &x) const override
Calculate the error of the factor, typically equal to log-likelihood.
Contains the HessianFactor class, a general quadratic factor.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Non-linear factor base classes.
Key precisionKey_
key by which to access precision variable
std::shared_ptr< GaussianFactor > linearize(const Values &x) const override
linearize returns a Hessianfactor that is an approximation of error(p)
Pose3 g1(Rot3(), Point3(100.0, 0.0, 300.0))
A Gaussian factor using the canonical parameters (information form)
Binary factor to estimate parameters of zero-mean Gaussian white noise.
Jet< T, N > sqrt(const Jet< T, N > &f)
WhiteNoiseFactor(double z, Key meanKey, Key precisionKey)
size_t dim() const override
get the dimension of the factor (number of rows on linearization)
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
Pose3 g2(g1.expmap(h *V1_g1))
std::uint64_t Key
Integer nonlinear key type.