From b5ea7e1ba04f979b041ad7ffe9df4d142b38b4c2 Mon Sep 17 00:00:00 2001 From: Abhijit Kundu Date: Thu, 7 Jun 2012 22:54:47 +0000 Subject: [PATCH] Fixes to DiscreteConditional --- gtsam/discrete/DiscreteConditional.cpp | 9 ++++++++- gtsam/discrete/DiscreteConditional.h | 5 +++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gtsam/discrete/DiscreteConditional.cpp b/gtsam/discrete/DiscreteConditional.cpp index ca8f13ca3..f9d3823d6 100644 --- a/gtsam/discrete/DiscreteConditional.cpp +++ b/gtsam/discrete/DiscreteConditional.cpp @@ -192,7 +192,14 @@ namespace gtsam { return sampled; return 0; - } + } + + /* ******************************************************************************** */ + void DiscreteConditional::permuteWithInverse(const Permutation& inversePermutation){ + IndexConditional::permuteWithInverse(inversePermutation); + Potentials::permute(inversePermutation); + } + /* ******************************************************************************** */ diff --git a/gtsam/discrete/DiscreteConditional.h b/gtsam/discrete/DiscreteConditional.h index f6603c195..6c724bf7f 100644 --- a/gtsam/discrete/DiscreteConditional.h +++ b/gtsam/discrete/DiscreteConditional.h @@ -111,6 +111,11 @@ namespace gtsam { /// sample in place, stores result in partial solution void sampleInPlace(Values& parentsValues) const; + /** + * Permutes both IndexConditional and Potentials. + */ + void permuteWithInverse(const Permutation& inversePermutation); + /// @} };