Fixed GaussianConditional equals hiding warning
parent
e1e0591b38
commit
95f8b3bf2e
|
|
@ -74,39 +74,46 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
bool GaussianConditional::equals(const GaussianConditional &c, double tol) const
|
bool GaussianConditional::equals(const GaussianFactor& f, double tol) const
|
||||||
{
|
{
|
||||||
// check if the size of the parents_ map is the same
|
if (const GaussianConditional* c = dynamic_cast<const GaussianConditional*>(&f))
|
||||||
if (parents().size() != c.parents().size())
|
{
|
||||||
return false;
|
// check if the size of the parents_ map is the same
|
||||||
|
if (parents().size() != c->parents().size())
|
||||||
|
return false;
|
||||||
|
|
||||||
// check if R_ and d_ are linear independent
|
// check if R_ and d_ are linear independent
|
||||||
for (DenseIndex i=0; i<Ab_.rows(); i++) {
|
for (DenseIndex i = 0; i < Ab_.rows(); i++) {
|
||||||
list<Vector> rows1; rows1.push_back(Vector(get_R().row(i)));
|
list<Vector> rows1; rows1.push_back(Vector(get_R().row(i)));
|
||||||
list<Vector> rows2; rows2.push_back(Vector(c.get_R().row(i)));
|
list<Vector> rows2; rows2.push_back(Vector(c->get_R().row(i)));
|
||||||
|
|
||||||
// check if the matrices are the same
|
// check if the matrices are the same
|
||||||
// iterate over the parents_ map
|
// iterate over the parents_ map
|
||||||
for (const_iterator it = beginParents(); it != endParents(); ++it) {
|
for (const_iterator it = beginParents(); it != endParents(); ++it) {
|
||||||
const_iterator it2 = c.beginParents() + (it-beginParents());
|
const_iterator it2 = c->beginParents() + (it - beginParents());
|
||||||
if(*it != *(it2))
|
if (*it != *(it2))
|
||||||
|
return false;
|
||||||
|
rows1.push_back(row(getA(it), i));
|
||||||
|
rows2.push_back(row(c->getA(it2), i));
|
||||||
|
}
|
||||||
|
|
||||||
|
Vector row1 = concatVectors(rows1);
|
||||||
|
Vector row2 = concatVectors(rows2);
|
||||||
|
if (!linear_dependent(row1, row2, tol))
|
||||||
return false;
|
return false;
|
||||||
rows1.push_back(row(getA(it), i));
|
|
||||||
rows2.push_back(row(c.getA(it2), i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector row1 = concatVectors(rows1);
|
// check if sigmas are equal
|
||||||
Vector row2 = concatVectors(rows2);
|
if ((model_ && !c->model_) || (!model_ && c->model_)
|
||||||
if (!linear_dependent(row1, row2, tol))
|
|| (model_ && c->model_ && !model_->equals(*c->model_, tol)))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// check if sigmas are equal
|
{
|
||||||
if ((model_ && !c.model_) || (!model_ && c.model_)
|
|
||||||
|| (model_ && c.model_ && !model_->equals(*c.model_, tol)))
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
||||||
|
|
@ -91,7 +91,7 @@ namespace gtsam {
|
||||||
const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
const KeyFormatter& formatter = DefaultKeyFormatter) const;
|
||||||
|
|
||||||
/** equals function */
|
/** equals function */
|
||||||
bool equals(const GaussianConditional&cg, double tol = 1e-9) const;
|
bool equals(const GaussianFactor&cg, double tol = 1e-9) const;
|
||||||
|
|
||||||
/** Return a view of the upper-triangular R block of the conditional */
|
/** Return a view of the upper-triangular R block of the conditional */
|
||||||
constABlock get_R() const { return Ab_.range(0, nrFrontals()); }
|
constABlock get_R() const { return Ab_.range(0, nrFrontals()); }
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue