New constructor and docs

release/4.3a0
Frank Dellaert 2024-09-21 15:14:35 -07:00
parent ed90121e0a
commit f84a4c71ae
2 changed files with 35 additions and 18 deletions

View File

@ -38,7 +38,7 @@ namespace gtsam {
* Gaussian factor in factors. * Gaussian factor in factors.
* @return HybridGaussianFactor::Factors * @return HybridGaussianFactor::Factors
*/ */
HybridGaussianFactor::Factors augment( static HybridGaussianFactor::Factors augment(
const HybridGaussianFactor::FactorValuePairs &factors) { const HybridGaussianFactor::FactorValuePairs &factors) {
// Find the minimum value so we can "proselytize" to positive values. // Find the minimum value so we can "proselytize" to positive values.
// Done because we can't have sqrt of negative numbers. // Done because we can't have sqrt of negative numbers.

View File

@ -89,25 +89,28 @@ class GTSAM_EXPORT HybridGaussianFactor : public HybridFactor {
HybridGaussianFactor() = default; HybridGaussianFactor() = default;
/** /**
* @brief Construct a new hybrid Gaussian factor. * @brief Construct a new HybridGaussianFactor on a single discrete key,
* * providing the factors for each mode m as a vector of factors ϕ_m(x).
* @param continuousKeys A vector of keys representing continuous variables. * The value ϕ(x,m) for the factor is simply ϕ_m(x).
* @param discreteKeys A vector of keys representing discrete variables and
* their cardinalities.
* @param factors The decision tree of Gaussian factors and arbitrary scalars.
*/
HybridGaussianFactor(const KeyVector &continuousKeys,
const DiscreteKeys &discreteKeys,
const FactorValuePairs &factors);
/**
* @brief Construct a new HybridGaussianFactor object using a vector of
* GaussianFactor shared pointers.
* *
* @param continuousKeys Vector of keys for continuous factors. * @param continuousKeys Vector of keys for continuous factors.
* @param discreteKey The discrete key to index each component. * @param discreteKey The discrete key for the "mode", indexing components.
* @param factors Vector of gaussian factor shared pointers * @param factors Vector of gaussian factors, one for each mode.
* and arbitrary scalars. Same size as the cardinality of discreteKey. */
HybridGaussianFactor(const KeyVector &continuousKeys,
const DiscreteKey &discreteKey,
const std::vector<GaussianFactor::shared_ptr> &factors)
: Base(continuousKeys, {discreteKey}), factors_({discreteKey}, factors) {}
/**
* @brief Construct a new HybridGaussianFactor on a single discrete key,
* including a scalar error value for each mode m. The factors and scalars are
* provided as a vector of pairs (ϕ_m(x), E_m).
* The value ϕ(x,m) for the factor is now ϕ_m(x) + E_m.
*
* @param continuousKeys Vector of keys for continuous factors.
* @param discreteKey The discrete key for the "mode", indexing components.
* @param factors Vector of gaussian factor-scalar pairs, one per mode.
*/ */
HybridGaussianFactor(const KeyVector &continuousKeys, HybridGaussianFactor(const KeyVector &continuousKeys,
const DiscreteKey &discreteKey, const DiscreteKey &discreteKey,
@ -115,6 +118,20 @@ class GTSAM_EXPORT HybridGaussianFactor : public HybridFactor {
: HybridGaussianFactor(continuousKeys, {discreteKey}, : HybridGaussianFactor(continuousKeys, {discreteKey},
FactorValuePairs({discreteKey}, factors)) {} FactorValuePairs({discreteKey}, factors)) {}
/**
* @brief Construct a new HybridGaussianFactor on a several discrete keys M,
* including a scalar error value for each assignment m. The factors and
* scalars are provided as a DecisionTree<Key> of pairs (ϕ_M(x), E_M).
* The value ϕ(x,M) for the factor is again ϕ_m(x) + E_m.
*
* @param continuousKeys A vector of keys representing continuous variables.
* @param discreteKeys Discrete variables and their cardinalities.
* @param factors The decision tree of Gaussian factor/scalar pairs.
*/
HybridGaussianFactor(const KeyVector &continuousKeys,
const DiscreteKeys &discreteKeys,
const FactorValuePairs &factors);
/// @} /// @}
/// @name Testable /// @name Testable
/// @{ /// @{