Moved key utilty functions back to MastSLAM
parent
16c11c70fb
commit
48fc15552a
5
gtsam.h
5
gtsam.h
|
@ -1450,11 +1450,6 @@ size_t symbol(char chr, size_t index);
|
||||||
char symbolChr(size_t key);
|
char symbolChr(size_t key);
|
||||||
size_t symbolIndex(size_t key);
|
size_t symbolIndex(size_t key);
|
||||||
|
|
||||||
// Key utilities
|
|
||||||
gtsam::KeySet keyIntersection(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB);
|
|
||||||
gtsam::KeySet keyDifference(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB);
|
|
||||||
bool hasKeyIntersection(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB);
|
|
||||||
|
|
||||||
// Default keyformatter
|
// Default keyformatter
|
||||||
void printKeySet(const gtsam::KeySet& keys);
|
void printKeySet(const gtsam::KeySet& keys);
|
||||||
void printKeySet(const gtsam::KeySet& keys, string s);
|
void printKeySet(const gtsam::KeySet& keys, string s);
|
||||||
|
|
|
@ -60,39 +60,6 @@ void printKeySet(const gtsam::KeySet& keys, const std::string& s, const KeyForma
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
gtsam::KeySet keyIntersection(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB) {
|
|
||||||
gtsam::KeySet intersection;
|
|
||||||
if (keysA.empty() || keysB.empty())
|
|
||||||
return intersection;
|
|
||||||
BOOST_FOREACH(const gtsam::Key& key, keysA)
|
|
||||||
if (keysB.count(key))
|
|
||||||
intersection.insert(key);
|
|
||||||
return intersection;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
bool hasKeyIntersection(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB) {
|
|
||||||
if (keysA.empty() || keysB.empty())
|
|
||||||
return false;
|
|
||||||
BOOST_FOREACH(const gtsam::Key& key, keysA)
|
|
||||||
if (keysB.count(key))
|
|
||||||
return true;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ************************************************************************* */
|
|
||||||
gtsam::KeySet keyDifference(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB) {
|
|
||||||
if (keysA.empty() || keysB.empty())
|
|
||||||
return keysA;
|
|
||||||
|
|
||||||
gtsam::KeySet difference;
|
|
||||||
BOOST_FOREACH(const gtsam::Key& key, keysA)
|
|
||||||
if (!keysB.count(key))
|
|
||||||
difference.insert(key);
|
|
||||||
return difference;
|
|
||||||
}
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
||||||
} // \namespace gtsam
|
} // \namespace gtsam
|
||||||
|
|
|
@ -60,14 +60,5 @@ namespace gtsam {
|
||||||
/// 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 KeySet& keys, const std::string& s = "",
|
||||||
const KeyFormatter& keyFormatter = DefaultKeyFormatter);
|
const KeyFormatter& keyFormatter = DefaultKeyFormatter);
|
||||||
|
|
||||||
/// Computes the intersection between two sets
|
|
||||||
GTSAM_EXPORT gtsam::KeySet keyIntersection(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB);
|
|
||||||
|
|
||||||
/// Checks if an intersection exists - faster checking size of above
|
|
||||||
GTSAM_EXPORT bool hasKeyIntersection(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB);
|
|
||||||
|
|
||||||
/// Computes a difference between sets, so result is those that are in A, but not B
|
|
||||||
GTSAM_EXPORT gtsam::KeySet keyDifference(const gtsam::KeySet& keysA, const gtsam::KeySet& keysB);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue