Fixed compile problem on linux using boost::join with boost::cref_list_of
parent
2388f5df45
commit
3528173781
|
|
@ -19,7 +19,7 @@
|
||||||
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544.2031210194" name="/" resourcePath="">
|
<folderInfo id="cdt.managedbuild.toolchain.gnu.macosx.base.1359703544.2031210194" name="/" resourcePath="">
|
||||||
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.677243255" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
|
<toolChain id="cdt.managedbuild.toolchain.gnu.macosx.base.677243255" name="cdt.managedbuild.toolchain.gnu.macosx.base" superClass="cdt.managedbuild.toolchain.gnu.macosx.base">
|
||||||
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.752782918" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
|
<targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.MachO64" id="cdt.managedbuild.target.gnu.platform.macosx.base.752782918" name="Debug Platform" osList="macosx" superClass="cdt.managedbuild.target.gnu.platform.macosx.base"/>
|
||||||
<builder arguments="" buildPath="${ProjDirPath}/build" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.319933862" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="5" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
|
<builder arguments="-j6" buildPath="${ProjDirPath}/build" command="make" id="cdt.managedbuild.target.gnu.builder.macosx.base.319933862" keepEnvironmentInBuildfile="false" managedBuildOn="false" name="Gnu Make Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.macosx.base"/>
|
||||||
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.457360678" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base"/>
|
<tool id="cdt.managedbuild.tool.macosx.c.linker.macosx.base.457360678" name="MacOS X C Linker" superClass="cdt.managedbuild.tool.macosx.c.linker.macosx.base"/>
|
||||||
<tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.1011140787" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base">
|
<tool id="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base.1011140787" name="MacOS X C++ Linker" superClass="cdt.managedbuild.tool.macosx.cpp.linker.macosx.base">
|
||||||
<inputType id="cdt.managedbuild.tool.macosx.cpp.linker.input.1032375444" superClass="cdt.managedbuild.tool.macosx.cpp.linker.input">
|
<inputType id="cdt.managedbuild.tool.macosx.cpp.linker.input.1032375444" superClass="cdt.managedbuild.tool.macosx.cpp.linker.input">
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <boost/function/function1.hpp>
|
#include <boost/function/function1.hpp>
|
||||||
|
#include <boost/range/concepts.hpp>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
|
@ -103,6 +104,31 @@ namespace gtsam {
|
||||||
operator T() const { return value; }
|
operator T() const { return value; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** A helper class that behaves as a container with one element, and works with
|
||||||
|
* boost::range */
|
||||||
|
template<typename T>
|
||||||
|
class ListOfOneContainer {
|
||||||
|
T element_;
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
typedef const T* const_iterator;
|
||||||
|
typedef T* iterator;
|
||||||
|
ListOfOneContainer(const T& element) : element_(element) {}
|
||||||
|
const T* begin() const { return &element_; }
|
||||||
|
const T* end() const { return &element_ + 1; }
|
||||||
|
T* begin() { return &element_; }
|
||||||
|
T* end() { return &element_ + 1; }
|
||||||
|
size_t size() const { return 1; }
|
||||||
|
};
|
||||||
|
|
||||||
|
BOOST_CONCEPT_ASSERT((boost::RandomAccessRangeConcept<ListOfOneContainer<int> >));
|
||||||
|
|
||||||
|
/** Factory function for ListOfOneContainer to enable ListOfOne(e) syntax. */
|
||||||
|
template<typename T>
|
||||||
|
ListOfOneContainer<T> ListOfOne(const T& element) {
|
||||||
|
return ListOfOneContainer<T>(element);
|
||||||
|
}
|
||||||
|
|
||||||
/** An assertion that throws an exception if NDEBUG is not defined and
|
/** An assertion that throws an exception if NDEBUG is not defined and
|
||||||
* evaluates to an empty statement otherwise. */
|
* evaluates to an empty statement otherwise. */
|
||||||
#ifdef NDEBUG
|
#ifdef NDEBUG
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,7 @@ namespace gtsam {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
// TODO: Clean up
|
||||||
namespace {
|
namespace {
|
||||||
template<class FACTOR, class CLIQUE>
|
template<class FACTOR, class CLIQUE>
|
||||||
int _pushClique(FactorGraph<FACTOR>& fg, const boost::shared_ptr<CLIQUE>& clique) {
|
int _pushClique(FactorGraph<FACTOR>& fg, const boost::shared_ptr<CLIQUE>& clique) {
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ namespace gtsam {
|
||||||
GaussianConditional::GaussianConditional(Index key, const Vector& d,
|
GaussianConditional::GaussianConditional(Index key, const Vector& d,
|
||||||
const Matrix& R, const PARENTS& parents, const SharedDiagonal& sigmas, const typename PARENTS::value_type*) :
|
const Matrix& R, const PARENTS& parents, const SharedDiagonal& sigmas, const typename PARENTS::value_type*) :
|
||||||
BaseFactor(boost::join(
|
BaseFactor(boost::join(
|
||||||
boost::assign::cref_list_of<1,typename PARENTS::value_type>(std::make_pair(key, R)),
|
ListOfOne<typename PARENTS::value_type>(std::make_pair(key, R)),
|
||||||
parents), d, sigmas),
|
parents), d, sigmas),
|
||||||
BaseConditional(1) {}
|
BaseConditional(1) {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -168,12 +168,14 @@ GaussianFactor(cref_list_of<3>(j1)(j2)(j3)),
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
namespace { DenseIndex _getSizeHF(const Vector& m) { return m.size(); } }
|
namespace {
|
||||||
|
DenseIndex _getSizeHF(const Vector& m) { return m.size(); }
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
HessianFactor::HessianFactor(const std::vector<Key>& js, const std::vector<Matrix>& Gs,
|
HessianFactor::HessianFactor(const std::vector<Key>& js, const std::vector<Matrix>& Gs,
|
||||||
const std::vector<Vector>& gs, double f) :
|
const std::vector<Vector>& gs, double f) :
|
||||||
GaussianFactor(js), info_(br::join(gs | br::transformed(&_getSizeHF), cref_list_of<1,DenseIndex>(1)))
|
GaussianFactor(js), info_(br::join(gs | br::transformed(&_getSizeHF), ListOfOne((DenseIndex)1)))
|
||||||
{
|
{
|
||||||
// Get the number of variables
|
// Get the number of variables
|
||||||
size_t variable_count = js.size();
|
size_t variable_count = js.size();
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include <gtsam/linear/linearExceptions.h>
|
#include <gtsam/linear/linearExceptions.h>
|
||||||
#include <boost/range/adaptor/transformed.hpp>
|
#include <boost/range/adaptor/transformed.hpp>
|
||||||
#include <boost/range/join.hpp>
|
#include <boost/range/join.hpp>
|
||||||
#include <boost/assign/list_of.hpp>
|
|
||||||
#include <boost/foreach.hpp>
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
@ -71,7 +70,7 @@ namespace gtsam {
|
||||||
void JacobianFactor::fillTerms(const TERMS& terms, const Vector& b, const SharedDiagonal& noiseModel)
|
void JacobianFactor::fillTerms(const TERMS& terms, const Vector& b, const SharedDiagonal& noiseModel)
|
||||||
{
|
{
|
||||||
// Check noise model dimension
|
// Check noise model dimension
|
||||||
if(noiseModel && noiseModel->dim() != b.size())
|
if(noiseModel && (DenseIndex)noiseModel->dim() != b.size())
|
||||||
throw InvalidNoiseModel(b.size(), noiseModel->dim());
|
throw InvalidNoiseModel(b.size(), noiseModel->dim());
|
||||||
|
|
||||||
// Resize base class key vector
|
// Resize base class key vector
|
||||||
|
|
@ -82,9 +81,8 @@ namespace gtsam {
|
||||||
// a single '1' to add a dimension for the b vector.
|
// a single '1' to add a dimension for the b vector.
|
||||||
{
|
{
|
||||||
using boost::adaptors::transformed;
|
using boost::adaptors::transformed;
|
||||||
using boost::assign::cref_list_of;
|
|
||||||
namespace br = boost::range;
|
namespace br = boost::range;
|
||||||
Ab_ = VerticalBlockMatrix(br::join(terms | transformed(&_getColsJF), cref_list_of<1,DenseIndex>(1)), b.size());
|
Ab_ = VerticalBlockMatrix(br::join(terms | transformed(&_getColsJF), ListOfOne((DenseIndex)1)), b.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check and add terms
|
// Check and add terms
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,7 @@ namespace gtsam {
|
||||||
|
|
||||||
// Allocate matrix and copy keys in order
|
// Allocate matrix and copy keys in order
|
||||||
gttic(allocate);
|
gttic(allocate);
|
||||||
Ab_ = VerticalBlockMatrix(boost::join(varDims, cref_list_of<1,DenseIndex>(1)), m); // Allocate augmented matrix
|
Ab_ = VerticalBlockMatrix(boost::join(varDims, ListOfOne((DenseIndex)1)), m); // Allocate augmented matrix
|
||||||
Base::keys_.resize(orderedSlots.size());
|
Base::keys_.resize(orderedSlots.size());
|
||||||
boost::range::copy( // Get variable keys
|
boost::range::copy( // Get variable keys
|
||||||
orderedSlots | boost::adaptors::indirected | boost::adaptors::map_keys, Base::keys_.begin());
|
orderedSlots | boost::adaptors::indirected | boost::adaptors::map_keys, Base::keys_.begin());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue