max returns DiscreteFactor
parent
2410d4f442
commit
5e4cf89ba9
|
@ -479,10 +479,9 @@ double DiscreteConditional::evaluate(const HybridValues& x) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
DiscreteConditional::shared_ptr DiscreteConditional::max(
|
DiscreteFactor::shared_ptr DiscreteConditional::max(
|
||||||
const Ordering& keys) const {
|
const Ordering& keys) const {
|
||||||
auto m = *BaseFactor::max(keys);
|
return BaseFactor::max(keys);
|
||||||
return std::make_shared<DiscreteConditional>(m.discreteKeys().size(), m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
@ -215,13 +215,13 @@ class GTSAM_EXPORT DiscreteConditional
|
||||||
size_t argmax(const DiscreteValues& parentsValues = DiscreteValues()) const;
|
size_t argmax(const DiscreteValues& parentsValues = DiscreteValues()) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create new conditional by maximizing over all
|
* @brief Create new factor by maximizing over all
|
||||||
* values with the same separator.
|
* values with the same separator.
|
||||||
*
|
*
|
||||||
* @param keys The keys to sum over.
|
* @param keys The keys to sum over.
|
||||||
* @return DiscreteConditional::shared_ptr
|
* @return DiscreteFactor::shared_ptr
|
||||||
*/
|
*/
|
||||||
virtual DiscreteConditional::shared_ptr max(const Ordering& keys) const;
|
virtual DiscreteFactor::shared_ptr max(const Ordering& keys) const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
/// @name Advanced Interface
|
/// @name Advanced Interface
|
||||||
|
|
|
@ -114,11 +114,8 @@ bool TableDistribution::equals(const DiscreteFactor& other, double tol) const {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ****************************************************************************/
|
/* ****************************************************************************/
|
||||||
DiscreteConditional::shared_ptr TableDistribution::max(
|
DiscreteFactor::shared_ptr TableDistribution::max(const Ordering& keys) const {
|
||||||
const Ordering& keys) const {
|
return table_.max(keys);
|
||||||
auto m = *table_.max(keys);
|
|
||||||
|
|
||||||
return std::make_shared<TableDistribution>(m);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************ */
|
/* ************************************************************************ */
|
||||||
|
|
|
@ -132,14 +132,13 @@ class GTSAM_EXPORT TableDistribution : public DiscreteConditional {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create new conditional by maximizing over all
|
* @brief Create new factor by maximizing over all
|
||||||
* values with the same separator.
|
* values with the same separator.
|
||||||
*
|
*
|
||||||
* @param keys The keys to sum over.
|
* @param keys The keys to sum over.
|
||||||
* @return DiscreteConditional::shared_ptr
|
* @return DiscreteFactor::shared_ptr
|
||||||
*/
|
*/
|
||||||
virtual DiscreteConditional::shared_ptr max(
|
virtual DiscreteFactor::shared_ptr max(const Ordering& keys) const override;
|
||||||
const Ordering& keys) const override;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Return assignment that maximizes value.
|
* @brief Return assignment that maximizes value.
|
||||||
|
|
Loading…
Reference in New Issue