Merge pull request #873 from borglab/feature/wrap-jacobian-factor

Jacobian Factor Wrapping
release/4.3a0
Varun Agrawal 2021-09-10 19:07:43 -04:00 committed by GitHub
commit 82d7cb5f29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 22 deletions

View File

@ -32,7 +32,7 @@
namespace gtsam { namespace gtsam {
/// Typedef for a function to format a key, i.e. to convert it to a string /// Typedef for a function to format a key, i.e. to convert it to a string
typedef std::function<std::string(Key)> KeyFormatter; using KeyFormatter = std::function<std::string(Key)>;
// Helper function for DefaultKeyFormatter // Helper function for DefaultKeyFormatter
GTSAM_EXPORT std::string _defaultKeyFormatter(Key key); GTSAM_EXPORT std::string _defaultKeyFormatter(Key key);
@ -83,28 +83,32 @@ class key_formatter {
}; };
/// Define collection type once and for all - also used in wrappers /// Define collection type once and for all - also used in wrappers
typedef FastVector<Key> KeyVector; using KeyVector = FastVector<Key>;
// TODO(frank): Nothing fast about these :-( // TODO(frank): Nothing fast about these :-(
typedef FastList<Key> KeyList; using KeyList = FastList<Key>;
typedef FastSet<Key> KeySet; using KeySet = FastSet<Key>;
typedef FastMap<Key, int> KeyGroupMap; using KeyGroupMap = FastMap<Key, int>;
/// Utility function to print one key with optional prefix /// Utility function to print one key with optional prefix
GTSAM_EXPORT void PrintKey(Key key, const std::string& s = "", GTSAM_EXPORT void PrintKey(
const KeyFormatter& keyFormatter = DefaultKeyFormatter); Key key, const std::string &s = "",
const KeyFormatter &keyFormatter = DefaultKeyFormatter);
/// Utility function to print sets of keys with optional prefix /// Utility function to print sets of keys with optional prefix
GTSAM_EXPORT void PrintKeyList(const KeyList& keys, const std::string& s = "", GTSAM_EXPORT void PrintKeyList(
const KeyFormatter& keyFormatter = DefaultKeyFormatter); const KeyList &keys, const std::string &s = "",
const KeyFormatter &keyFormatter = DefaultKeyFormatter);
/// Utility function to print sets of keys with optional prefix /// Utility function to print sets of keys with optional prefix
GTSAM_EXPORT void PrintKeyVector(const KeyVector& keys, const std::string& s = GTSAM_EXPORT void PrintKeyVector(
"", const KeyFormatter& keyFormatter = DefaultKeyFormatter); const KeyVector &keys, const std::string &s = "",
const KeyFormatter &keyFormatter = DefaultKeyFormatter);
/// Utility function to print sets of keys with optional prefix /// Utility function to print sets of keys with optional prefix
GTSAM_EXPORT void PrintKeySet(const KeySet& keys, const std::string& s = "", GTSAM_EXPORT void PrintKeySet(
const KeyFormatter& keyFormatter = DefaultKeyFormatter); const KeySet &keys, const std::string &s = "",
const KeyFormatter &keyFormatter = DefaultKeyFormatter);
// Define Key to be Testable by specializing gtsam::traits // Define Key to be Testable by specializing gtsam::traits
template<typename T> struct traits; template<typename T> struct traits;

View File

@ -289,6 +289,13 @@ virtual class JacobianFactor : gtsam::GaussianFactor {
JacobianFactor(size_t i1, Matrix A1, size_t i2, Matrix A2, size_t i3, Matrix A3, JacobianFactor(size_t i1, Matrix A1, size_t i2, Matrix A2, size_t i3, Matrix A3,
Vector b, const gtsam::noiseModel::Diagonal* model); Vector b, const gtsam::noiseModel::Diagonal* model);
JacobianFactor(const gtsam::GaussianFactorGraph& graph); JacobianFactor(const gtsam::GaussianFactorGraph& graph);
JacobianFactor(const gtsam::GaussianFactorGraph& graph,
const gtsam::VariableSlots& p_variableSlots);
JacobianFactor(const gtsam::GaussianFactorGraph& graph,
const gtsam::Ordering& ordering);
JacobianFactor(const gtsam::GaussianFactorGraph& graph,
const gtsam::Ordering& ordering,
const gtsam::VariableSlots& p_variableSlots);
//Testable //Testable
void print(string s = "", const gtsam::KeyFormatter& keyFormatter = void print(string s = "", const gtsam::KeyFormatter& keyFormatter =

View File

@ -75,12 +75,15 @@ size_t Z(size_t j);
} // namespace symbol_shorthand } // namespace symbol_shorthand
// Default keyformatter // Default keyformatter
void PrintKeyList(const gtsam::KeyList& keys); void PrintKeyList(
void PrintKeyList(const gtsam::KeyList& keys, string s); const gtsam::KeyList& keys, const string& s = "",
void PrintKeyVector(const gtsam::KeyVector& keys); const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter);
void PrintKeyVector(const gtsam::KeyVector& keys, string s); void PrintKeyVector(
void PrintKeySet(const gtsam::KeySet& keys); const gtsam::KeyVector& keys, const string& s = "",
void PrintKeySet(const gtsam::KeySet& keys, string s); const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter);
void PrintKeySet(
const gtsam::KeySet& keys, const string& s = "",
const gtsam::KeyFormatter& keyFormatter = gtsam::DefaultKeyFormatter);
#include <gtsam/inference/LabeledSymbol.h> #include <gtsam/inference/LabeledSymbol.h>
class LabeledSymbol { class LabeledSymbol {

View File

@ -1,7 +1,7 @@
/** /**
* @file gtsam.cpp * @file {module_name}.cpp
* @brief The auto-generated wrapper C++ source code. * @brief The auto-generated wrapper C++ source code.
* @author Duy-Nguyen Ta, Fan Jiang, Matthew Sklar * @author Duy-Nguyen Ta, Fan Jiang, Matthew Sklar, Varun Agrawal
* @date Aug. 18, 2020 * @date Aug. 18, 2020
* *
* ** THIS FILE IS AUTO-GENERATED, DO NOT MODIFY! ** * ** THIS FILE IS AUTO-GENERATED, DO NOT MODIFY! **