diff --git a/gtsam/discrete/DiscreteFactor.h b/gtsam/discrete/DiscreteFactor.h index a6356a045..2fe80a54c 100644 --- a/gtsam/discrete/DiscreteFactor.h +++ b/gtsam/discrete/DiscreteFactor.h @@ -144,7 +144,6 @@ class GTSAM_EXPORT DiscreteFactor : public Factor { /// Create new factor by maximizing over all values with the same separator. virtual DiscreteFactor::shared_ptr max(const Ordering& keys) const = 0; - /** * Get the number of non-zero values contained in this factor. * It could be much smaller than `prod_{key}(cardinality(key))`. diff --git a/gtsam/discrete/TableFactor.h b/gtsam/discrete/TableFactor.h index 64e98c6a1..41b6287b8 100644 --- a/gtsam/discrete/TableFactor.h +++ b/gtsam/discrete/TableFactor.h @@ -17,6 +17,7 @@ #pragma once +#include #include #include #include @@ -177,6 +178,8 @@ class GTSAM_EXPORT TableFactor : public DiscreteFactor { return apply(*tf, safe_div); } else if (auto dtf = std::dynamic_pointer_cast(f)) { return apply(TableFactor(f->discreteKeys(), *dtf), safe_div); + } else { + throw std::runtime_error("Unknown derived type for DiscreteFactor"); } }