-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from varunagrawal/fix/hybrid-elimination
- Loading branch information
Showing
6 changed files
with
166 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
// | ||
// Created by Fan Jiang on 1/24/22. | ||
// | ||
/* ---------------------------------------------------------------------------- | ||
* GTSAM Copyright 2010, Georgia Tech Research Corporation, | ||
* Atlanta, Georgia 30332-0415 | ||
* All Rights Reserved | ||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list) | ||
* See LICENSE for the license information | ||
* -------------------------------------------------------------------------- */ | ||
|
||
/** | ||
* @file HybridBayesNet.cpp | ||
* @brief A bayes net of Gaussian Conditionals indexed by discrete keys. | ||
* @author Fan Jiang | ||
* @date January 2022 | ||
*/ | ||
|
||
#include <gtsam/hybrid/HybridBayesNet.h> | ||
|
||
namespace gtsam { | ||
|
||
GaussianMixture::shared_ptr HybridBayesNet::atGaussian(size_t i) { | ||
GaussianMixture::shared_ptr HybridBayesNet::atGaussian(size_t i) const { | ||
return boost::dynamic_pointer_cast<GaussianMixture>(factors_.at(i)); | ||
} | ||
DiscreteConditional::shared_ptr HybridBayesNet::atDiscrete(size_t i) { | ||
|
||
DiscreteConditional::shared_ptr HybridBayesNet::atDiscrete(size_t i) const { | ||
return boost::dynamic_pointer_cast<DiscreteConditional>(factors_.at(i)); | ||
} | ||
|
||
GaussianBayesNet HybridBayesNet::choose( | ||
const DiscreteValues& assignment) const { | ||
GaussianBayesNet gbn; | ||
for (size_t idx = 0; idx < size(); idx++) { | ||
GaussianMixture gm = *this->atGaussian(idx); | ||
gbn.push_back(gm(assignment)); | ||
} | ||
return gbn; | ||
} | ||
|
||
} // namespace gtsam |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters