Cherry-picked Boost 1.57 fixes from develop
parent
f1d46d0a78
commit
4c2e387204
|
|
@ -215,7 +215,10 @@ Eigen::Block<const MATRIX> sub(const MATRIX& A, size_t i1, size_t i2, size_t j1,
|
|||
* @param i is the row of the upper left corner insert location
|
||||
* @param j is the column of the upper left corner insert location
|
||||
*/
|
||||
GTSAM_EXPORT void insertSub(Matrix& fullMatrix, const Matrix& subMatrix, size_t i, size_t j);
|
||||
template <typename Derived1, typename Derived2>
|
||||
void insertSub(Eigen::MatrixBase<Derived1>& fullMatrix, const Eigen::MatrixBase<Derived2>& subMatrix, size_t i, size_t j) {
|
||||
fullMatrix.block(i, j, subMatrix.rows(), subMatrix.cols()) = subMatrix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a matrix with submatrices along its diagonal
|
||||
|
|
|
|||
|
|
@ -17,12 +17,8 @@
|
|||
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/mpl/char.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/lambda/bind.hpp>
|
||||
#include <boost/lambda/construct.hpp>
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
|
@ -111,23 +107,21 @@ bool LabeledSymbol::operator!=(gtsam::Key comp) const {
|
|||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
static LabeledSymbol make(gtsam::Key key) { return LabeledSymbol(key);}
|
||||
|
||||
boost::function<bool(gtsam::Key)> LabeledSymbol::TypeTest(unsigned char c) {
|
||||
namespace bl = boost::lambda;
|
||||
return bl::bind(&LabeledSymbol::chr, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == c;
|
||||
return bind(&LabeledSymbol::chr, bind(make, _1)) == c;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
boost::function<bool(gtsam::Key)> LabeledSymbol::LabelTest(unsigned char label) {
|
||||
namespace bl = boost::lambda;
|
||||
return bl::bind(&LabeledSymbol::label, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == label;
|
||||
return bind(&LabeledSymbol::label, bind(make, _1)) == label;
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
boost::function<bool(gtsam::Key)> LabeledSymbol::TypeLabelTest(unsigned char c, unsigned char label) {
|
||||
namespace bl = boost::lambda;
|
||||
return bl::bind(&LabeledSymbol::chr, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == c &&
|
||||
bl::bind(&LabeledSymbol::label, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == label;
|
||||
return bind(&LabeledSymbol::chr, bind(make, _1)) == c &&
|
||||
bind(&LabeledSymbol::label, bind(make, _1)) == label;
|
||||
}
|
||||
/* ************************************************************************* */
|
||||
|
||||
} // \namespace gtsam
|
||||
|
||||
|
|
|
|||
|
|
@ -18,19 +18,8 @@
|
|||
|
||||
#include <gtsam/inference/Symbol.h>
|
||||
|
||||
#include <boost/mpl/char.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <boost/lambda/construct.hpp>
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-variable"
|
||||
#endif
|
||||
#include <boost/lambda/bind.hpp>
|
||||
#include <boost/lambda/lambda.hpp>
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
#include <limits.h>
|
||||
#include <list>
|
||||
|
|
@ -71,10 +60,10 @@ Symbol::operator std::string() const {
|
|||
return str(boost::format("%c%d") % c_ % j_);
|
||||
}
|
||||
|
||||
static Symbol make(gtsam::Key key) { return Symbol(key);}
|
||||
|
||||
boost::function<bool(Key)> Symbol::ChrTest(unsigned char c) {
|
||||
namespace bl = boost::lambda;
|
||||
return bl::bind(&Symbol::chr, bl::bind(bl::constructor<Symbol>(), bl::_1))
|
||||
== c;
|
||||
return bind(&Symbol::chr, bind(make, _1)) == c;
|
||||
}
|
||||
|
||||
} // namespace gtsam
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@
|
|||
* @author Alex Cunningham
|
||||
*/
|
||||
|
||||
#include <boost/assign/std/list.hpp> // for operator +=
|
||||
using namespace boost::assign;
|
||||
|
||||
#include <CppUnitLite/TestHarness.h>
|
||||
#include <gtsam/inference/Symbol.h>
|
||||
#include <gtsam/base/Testable.h>
|
||||
#include <gtsam/base/TestableAssertions.h>
|
||||
#include <gtsam/inference/Symbol.h>
|
||||
|
||||
#include <CppUnitLite/TestHarness.h>
|
||||
|
||||
#include <boost/assign/std/list.hpp> // for operator +=
|
||||
using namespace boost::assign;
|
||||
using namespace std;
|
||||
using namespace gtsam;
|
||||
|
||||
|
|
@ -65,6 +65,13 @@ TEST(Key, KeySymbolEncoding) {
|
|||
EXPECT(assert_equal(symbol, Symbol(key)));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(Key, ChrTest) {
|
||||
Key key = Symbol('c',3);
|
||||
EXPECT(Symbol::ChrTest('c')(key));
|
||||
EXPECT(!Symbol::ChrTest('d')(key));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
|
|
@ -14,20 +14,19 @@
|
|||
* @author Alex Cunningham
|
||||
*/
|
||||
|
||||
#include <boost/assign/std/list.hpp> // for operator +=
|
||||
using namespace boost::assign;
|
||||
|
||||
#include <CppUnitLite/TestHarness.h>
|
||||
#include <gtsam/inference/LabeledSymbol.h>
|
||||
#include <gtsam/base/Testable.h>
|
||||
#include <gtsam/base/TestableAssertions.h>
|
||||
|
||||
#include <gtsam/inference/LabeledSymbol.h>
|
||||
|
||||
#include <CppUnitLite/TestHarness.h>
|
||||
#include <boost/assign/std/list.hpp> // for operator +=
|
||||
|
||||
using namespace boost::assign;
|
||||
using namespace std;
|
||||
using namespace gtsam;
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST( testLabeledSymbol, KeyLabeledSymbolConversion ) {
|
||||
TEST(LabeledSymbol, KeyLabeledSymbolConversion ) {
|
||||
LabeledSymbol expected('x', 'A', 4);
|
||||
Key key(expected);
|
||||
LabeledSymbol actual(key);
|
||||
|
|
@ -36,7 +35,7 @@ TEST( testLabeledSymbol, KeyLabeledSymbolConversion ) {
|
|||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) {
|
||||
TEST(LabeledSymbol, KeyLabeledSymbolEncoding ) {
|
||||
|
||||
// Test encoding of LabeledSymbol <-> size_t <-> string
|
||||
// Encoding scheme:
|
||||
|
|
@ -69,6 +68,17 @@ TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) {
|
|||
}
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
TEST(LabeledSymbol, ChrTest) {
|
||||
Key key = LabeledSymbol('c','A',3);
|
||||
EXPECT(LabeledSymbol::TypeTest('c')(key));
|
||||
EXPECT(!LabeledSymbol::TypeTest('d')(key));
|
||||
EXPECT(LabeledSymbol::LabelTest('A')(key));
|
||||
EXPECT(!LabeledSymbol::LabelTest('D')(key));
|
||||
EXPECT(LabeledSymbol::TypeLabelTest('c','A')(key));
|
||||
EXPECT(!LabeledSymbol::TypeLabelTest('c','D')(key));
|
||||
}
|
||||
|
||||
/* ************************************************************************* */
|
||||
int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
|
||||
/* ************************************************************************* */
|
||||
|
|
|
|||
Loading…
Reference in New Issue