diff --git a/gtsam/hybrid/GaussianMixtureFactor.h b/gtsam/hybrid/GaussianMixtureFactor.h index 7e9edbe86..ad8e19f02 100644 --- a/gtsam/hybrid/GaussianMixtureFactor.h +++ b/gtsam/hybrid/GaussianMixtureFactor.h @@ -83,6 +83,19 @@ class GTSAM_EXPORT GaussianMixtureFactor : public HybridFactor { bool operator==(const GraphAndConstant &other) const { return graph == other.graph && constant == other.constant; } + + // Implement GTSAM-style print: + void print(const std::string &s = "Graph: ", + const KeyFormatter &formatter = DefaultKeyFormatter) const { + graph.print(s, formatter); + std::cout << "Constant: " << constant << std::endl; + } + + // Implement GTSAM-style equals: + bool equals(const GraphAndConstant &other, double tol = 1e-9) const { + return graph.equals(other.graph, tol) && + fabs(constant - other.constant) < tol; + } }; using Sum = DecisionTree; @@ -200,4 +213,8 @@ template <> struct traits : public Testable { }; +template <> +struct traits + : public Testable {}; + } // namespace gtsam