timing
parent
1d79188417
commit
77578512f8
|
|
@ -22,7 +22,6 @@
|
|||
#include <gtsam/discrete/DiscreteFactorGraph.h>
|
||||
#include <gtsam/discrete/DiscreteJunctionTree.h>
|
||||
#include <gtsam/discrete/DiscreteLookupDAG.h>
|
||||
#include <gtsam/discrete/TableFactor.h>
|
||||
#include <gtsam/inference/EliminateableFactorGraph-inst.h>
|
||||
#include <gtsam/inference/FactorGraph-inst.h>
|
||||
|
||||
|
|
@ -127,14 +126,14 @@ namespace gtsam {
|
|||
static DiscreteFactor::shared_ptr Normalize(
|
||||
const DiscreteFactor::shared_ptr& product) {
|
||||
// Max over all the potentials by pretending all keys are frontal:
|
||||
gttic(DiscreteFindMax);
|
||||
gttic_(DiscreteFindMax);
|
||||
auto normalization = product->max(product->size());
|
||||
gttoc(DiscreteFindMax);
|
||||
gttoc_(DiscreteFindMax);
|
||||
|
||||
gttic(DiscreteNormalization);
|
||||
gttic_(DiscreteNormalization);
|
||||
// Normalize the product factor to prevent underflow.
|
||||
auto normalized_product = product->operator/(normalization);
|
||||
gttoc(DiscreteNormalization);
|
||||
gttoc_(DiscreteNormalization);
|
||||
|
||||
return normalized_product;
|
||||
}
|
||||
|
|
@ -260,7 +259,7 @@ namespace gtsam {
|
|||
gttic_(divide);
|
||||
auto conditional =
|
||||
std::make_shared<DiscreteConditional>(product, sum, orderedKeys);
|
||||
gttoc(divide);
|
||||
gttoc_(divide);
|
||||
|
||||
return {conditional, sum};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,15 @@ class GTSAM_EXPORT DiscreteLookupTable : public DiscreteConditional {
|
|||
const ADT& potentials)
|
||||
: DiscreteConditional(nFrontals, keys, potentials) {}
|
||||
|
||||
//TODO(Varun): Should accept a DiscreteFactor::shared_ptr
|
||||
/**
|
||||
* @brief Construct a new Discrete Lookup Table object
|
||||
*
|
||||
* @param nFrontals number of frontal variables
|
||||
* @param keys a sorted list of gtsam::Keys
|
||||
* @param potentials Discrete potentials as a TableFactor.
|
||||
*
|
||||
* //TODO(Varun): Should accept a DiscreteFactor::shared_ptr
|
||||
*/
|
||||
DiscreteLookupTable(size_t nFrontals, const DiscreteKeys& keys,
|
||||
const TableFactor& potentials)
|
||||
: DiscreteConditional(nFrontals, keys,
|
||||
|
|
|
|||
Loading…
Reference in New Issue