@@ -112,54 +112,6 @@ class DCMixtureFactor : public DCFactor {
112112 // error.
113113 return factors_[assignment].linearize (continuousVals);
114114 }
115-
116- /* *
117- * If the component factors are not already normalized, we want to compute
118- * their normalizing constants so that the resulting joint distribution is
119- * appropriately computed. Remember, this is the _negative_ normalizing
120- * constant for the measurement likelihood (since we are minimizing the
121- * _negative_ log-likelihood).
122- */
123- double nonlinearFactorLogNormalizingConstant (
124- const NonlinearFactorType& factor, const gtsam::Values& values) const {
125- // Information matrix (inverse covariance matrix) for the factor.
126- gtsam::Matrix infoMat;
127-
128- // NOTE: This is sloppy, is there a cleaner way?
129- boost::shared_ptr<NonlinearFactorType> fPtr =
130- boost::make_shared<NonlinearFactorType>(factor);
131- boost::shared_ptr<gtsam::NonlinearFactor> factorPtr (fPtr );
132-
133- // If this is a NoiseModelFactor, we'll use its noiseModel to
134- // otherwise noiseModelFactor will be nullptr
135- boost::shared_ptr<gtsam::NoiseModelFactor> noiseModelFactor =
136- boost::dynamic_pointer_cast<gtsam::NoiseModelFactor>(factorPtr);
137- if (noiseModelFactor) {
138- // If dynamic cast to NoiseModelFactor succeeded, see if the noise model
139- // is Gaussian
140- gtsam::noiseModel::Base::shared_ptr noiseModel =
141- noiseModelFactor->noiseModel ();
142-
143- boost::shared_ptr<gtsam::noiseModel::Gaussian> gaussianNoiseModel =
144- boost::dynamic_pointer_cast<gtsam::noiseModel::Gaussian>(noiseModel);
145- if (gaussianNoiseModel) {
146- // If the noise model is Gaussian, retrieve the information matrix
147- infoMat = gaussianNoiseModel->information ();
148- } else {
149- // If the factor is not a Gaussian factor, we'll linearize it to get
150- // something with a normalized noise model
151- // TODO(kevin): does this make sense to do? I think maybe not in
152- // general? Should we just yell at the user?
153- boost::shared_ptr<gtsam::GaussianFactor> gaussianFactor =
154- factor.linearize (values);
155- infoMat = gaussianFactor->information ();
156- }
157- }
158-
159- // Compute the (negative) log of the normalizing constant
160- return -(factor.dim () * log (2.0 * M_PI ) / 2.0 ) -
161- (log (infoMat.determinant ()) / 2.0 );
162- }
163115};
164116
165117} // namespace dcsam
0 commit comments