Fixed a bug in checking for empty-matrix Jacobians that still have keys (kind of a hack)

release/4.3a0
Richard Roberts 2013-11-05 16:06:14 +00:00
parent f262801932
commit 411e934385
2 changed files with 2 additions and 2 deletions

View File

@ -73,7 +73,7 @@ Scatter::Scatter(const GaussianFactorGraph& gfg, boost::optional<const Ordering&
for(GaussianFactor::const_iterator variable = factor->begin(); variable != factor->end(); ++variable) { for(GaussianFactor::const_iterator variable = factor->begin(); variable != factor->end(); ++variable) {
// TODO: Fix this hack to cope with zero-row Jacobians that come from BayesTreeOrphanWrappers // TODO: Fix this hack to cope with zero-row Jacobians that come from BayesTreeOrphanWrappers
const JacobianFactor* asJacobian = dynamic_cast<const JacobianFactor*>(factor.get()); const JacobianFactor* asJacobian = dynamic_cast<const JacobianFactor*>(factor.get());
if(!asJacobian || asJacobian->rows() > 0) if(!asJacobian || asJacobian->cols() > 1)
this->insert(make_pair(*variable, SlotEntry(none, factor->getDim(variable)))); this->insert(make_pair(*variable, SlotEntry(none, factor->getDim(variable))));
} }
} }

View File

@ -162,7 +162,7 @@ namespace gtsam {
const size_t sourceVarpos = slots->second[sourceFactorI]; const size_t sourceVarpos = slots->second[sourceFactorI];
if(sourceVarpos < numeric_limits<size_t>::max()) { if(sourceVarpos < numeric_limits<size_t>::max()) {
const JacobianFactor& sourceFactor = *factors[sourceFactorI]; const JacobianFactor& sourceFactor = *factors[sourceFactorI];
if(sourceFactor.cols() > 0) { if(sourceFactor.cols() > 1) {
foundVariable = true; foundVariable = true;
DenseIndex vardim = sourceFactor.getDim(sourceFactor.begin() + sourceVarpos); DenseIndex vardim = sourceFactor.getDim(sourceFactor.begin() + sourceVarpos);