Merge branch 'release/3.2.1'

release/4.3a0
cbeall3 2015-03-07 00:07:12 -05:00
commit 3c1d2746a8
8 changed files with 52 additions and 49 deletions

View File

@ -11,7 +11,7 @@ endif()
# Set the version number for the library # Set the version number for the library
set (GTSAM_VERSION_MAJOR 3) set (GTSAM_VERSION_MAJOR 3)
set (GTSAM_VERSION_MINOR 2) set (GTSAM_VERSION_MINOR 2)
set (GTSAM_VERSION_PATCH 0) set (GTSAM_VERSION_PATCH 1)
math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}") math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}")
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}") set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}")
@ -129,7 +129,7 @@ else()
endif() endif()
if(${Boost_VERSION} EQUAL 105600) if(NOT (${Boost_VERSION} LESS 105600))
message("Ignoring Boost restriction on optional lvalue assignment from rvalues") message("Ignoring Boost restriction on optional lvalue assignment from rvalues")
add_definitions(-DBOOST_OPTIONAL_ALLOW_BINDING_TO_RVALUES) add_definitions(-DBOOST_OPTIONAL_ALLOW_BINDING_TO_RVALUES)
endif() endif()

View File

@ -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 i is the row of the upper left corner insert location
* @param j is the column 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 * Create a matrix with submatrices along its diagonal

View File

@ -17,12 +17,8 @@
#include <iostream> #include <iostream>
#include <boost/mpl/char.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/function.hpp> #include <boost/bind.hpp>
#include <boost/lambda/bind.hpp>
#include <boost/lambda/construct.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lexical_cast.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) { boost::function<bool(gtsam::Key)> LabeledSymbol::TypeTest(unsigned char c) {
namespace bl = boost::lambda; return boost::bind(&LabeledSymbol::chr, boost::bind(make, _1)) == c;
return bl::bind(&LabeledSymbol::chr, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == c;
} }
/* ************************************************************************* */
boost::function<bool(gtsam::Key)> LabeledSymbol::LabelTest(unsigned char label) { boost::function<bool(gtsam::Key)> LabeledSymbol::LabelTest(unsigned char label) {
namespace bl = boost::lambda; return boost::bind(&LabeledSymbol::label, boost::bind(make, _1)) == label;
return bl::bind(&LabeledSymbol::label, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == label;
} }
/* ************************************************************************* */
boost::function<bool(gtsam::Key)> LabeledSymbol::TypeLabelTest(unsigned char c, unsigned char label) { boost::function<bool(gtsam::Key)> LabeledSymbol::TypeLabelTest(unsigned char c, unsigned char label) {
namespace bl = boost::lambda; return boost::bind(&LabeledSymbol::chr, boost::bind(make, _1)) == c &&
return bl::bind(&LabeledSymbol::chr, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == c && boost::bind(&LabeledSymbol::label, boost::bind(make, _1)) == label;
bl::bind(&LabeledSymbol::label, bl::bind(bl::constructor<LabeledSymbol>(), bl::_1)) == label;
} }
/* ************************************************************************* */
} // \namespace gtsam } // \namespace gtsam

View File

@ -18,19 +18,8 @@
#include <gtsam/inference/Symbol.h> #include <gtsam/inference/Symbol.h>
#include <boost/mpl/char.hpp>
#include <boost/format.hpp> #include <boost/format.hpp>
#include <boost/function.hpp> #include <boost/bind.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 <limits.h> #include <limits.h>
#include <list> #include <list>
@ -71,10 +60,10 @@ Symbol::operator std::string() const {
return str(boost::format("%c%d") % c_ % j_); 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) { boost::function<bool(Key)> Symbol::ChrTest(unsigned char c) {
namespace bl = boost::lambda; return bind(&Symbol::chr, bind(make, _1)) == c;
return bl::bind(&Symbol::chr, bl::bind(bl::constructor<Symbol>(), bl::_1))
== c;
} }
} // namespace gtsam } // namespace gtsam

View File

@ -14,14 +14,14 @@
* @author Alex Cunningham * @author Alex Cunningham
*/ */
#include <boost/assign/std/list.hpp> // for operator += #include <gtsam/inference/Symbol.h>
using namespace boost::assign;
#include <CppUnitLite/TestHarness.h>
#include <gtsam/base/Testable.h> #include <gtsam/base/Testable.h>
#include <gtsam/base/TestableAssertions.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 std;
using namespace gtsam; using namespace gtsam;
@ -65,6 +65,13 @@ TEST(Key, KeySymbolEncoding) {
EXPECT(assert_equal(symbol, Symbol(key))); 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); } int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -14,20 +14,19 @@
* @author Alex Cunningham * @author Alex Cunningham
*/ */
#include <boost/assign/std/list.hpp> // for operator += #include <gtsam/inference/LabeledSymbol.h>
using namespace boost::assign;
#include <CppUnitLite/TestHarness.h>
#include <gtsam/base/Testable.h> #include <gtsam/base/Testable.h>
#include <gtsam/base/TestableAssertions.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 std;
using namespace gtsam; using namespace gtsam;
/* ************************************************************************* */ /* ************************************************************************* */
TEST( testLabeledSymbol, KeyLabeledSymbolConversion ) { TEST(LabeledSymbol, KeyLabeledSymbolConversion ) {
LabeledSymbol expected('x', 'A', 4); LabeledSymbol expected('x', 'A', 4);
Key key(expected); Key key(expected);
LabeledSymbol actual(key); LabeledSymbol actual(key);
@ -36,7 +35,7 @@ TEST( testLabeledSymbol, KeyLabeledSymbolConversion ) {
} }
/* ************************************************************************* */ /* ************************************************************************* */
TEST( testLabeledSymbol, KeyLabeledSymbolEncoding ) { TEST(LabeledSymbol, KeyLabeledSymbolEncoding ) {
// Test encoding of LabeledSymbol <-> size_t <-> string // Test encoding of LabeledSymbol <-> size_t <-> string
// Encoding scheme: // 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); } int main() { TestResult tr; return TestRegistry::runAllTests(tr); }
/* ************************************************************************* */ /* ************************************************************************* */

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<package format="2"> <package format="2">
<name>gtsam</name> <name>gtsam</name>
<version>3.1.0</version> <version>3.2.1</version>
<description>gtsam</description> <description>gtsam</description>
<maintainer email="gtsam@lists.gatech.edu">Frank Dellaert</maintainer> <maintainer email="gtsam@lists.gatech.edu">Frank Dellaert</maintainer>

View File

@ -62,9 +62,9 @@ int main(int argc, char* argv[]) {
gtsam::SubMatrix top = mat.block(0, 0, n, n); gtsam::SubMatrix top = mat.block(0, 0, n, n);
gtsam::SubMatrix block = mat.block(m/4, n/4, m-m/2, n-n/2); gtsam::SubMatrix block = mat.block(m/4, n/4, m-m/2, n-n/2);
cout << format(" Basic: %1%x%2%\n") % m % n; cout << format(" Basic: %1%x%2%\n") % (int)m % (int)n;
cout << format(" Full: mat(%1%:%2%, %3%:%4%)\n") % 0 % m % 0 % n; cout << format(" Full: mat(%1%:%2%, %3%:%4%)\n") % 0 % (int)m % 0 % (int)n;
cout << format(" Top: mat(%1%:%2%, %3%:%4%)\n") % 0 % n % 0 % n; cout << format(" Top: mat(%1%:%2%, %3%:%4%)\n") % 0 % (int)n % 0 % (int)n;
cout << format(" Block: mat(%1%:%2%, %3%:%4%)\n") % size_t(m/4) % size_t(m-m/4) % size_t(n/4) % size_t(n-n/4); cout << format(" Block: mat(%1%:%2%, %3%:%4%)\n") % size_t(m/4) % size_t(m-m/4) % size_t(n/4) % size_t(n-n/4);
cout << endl; cout << endl;