Initial changes to compile on windows
parent
2060f1dd22
commit
25a53815e0
|
|
@ -50,7 +50,7 @@ public:
|
||||||
* Destroy and deallocate this object, only if it was originally allocated using clone_().
|
* Destroy and deallocate this object, only if it was originally allocated using clone_().
|
||||||
*/
|
*/
|
||||||
virtual void deallocate_() const {
|
virtual void deallocate_() const {
|
||||||
this->~Value();
|
this->Value::~Value();
|
||||||
boost::singleton_pool<PoolTag, sizeof(DERIVED)>::free((void*)this);
|
boost::singleton_pool<PoolTag, sizeof(DERIVED)>::free((void*)this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
* @author Christian Potthast
|
* @author Christian Potthast
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <gtsam/base/types.h>
|
||||||
#include <gtsam/base/Matrix.h>
|
#include <gtsam/base/Matrix.h>
|
||||||
#include <gtsam/base/timing.h>
|
#include <gtsam/base/timing.h>
|
||||||
#include <gtsam/base/Vector.h>
|
#include <gtsam/base/Vector.h>
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
#include <gtsam/3rdparty/Eigen/Eigen/QR>
|
#include <gtsam/3rdparty/Eigen/Eigen/QR>
|
||||||
#include <boost/format.hpp>
|
#include <boost/format.hpp>
|
||||||
#include <boost/tuple/tuple.hpp>
|
#include <boost/tuple/tuple.hpp>
|
||||||
|
#include <boost/math/special_functions/fpclassify.hpp>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Matrix is a typedef in the gtsam namespace
|
* Matrix is a typedef in the gtsam namespace
|
||||||
|
|
@ -87,7 +88,7 @@ bool equal_with_abs_tol(const Eigen::DenseBase<MATRIX>& A, const Eigen::DenseBas
|
||||||
|
|
||||||
for(size_t i=0; i<m1; i++)
|
for(size_t i=0; i<m1; i++)
|
||||||
for(size_t j=0; j<n1; j++) {
|
for(size_t j=0; j<n1; j++) {
|
||||||
if(std::isnan(A(i,j)) xor std::isnan(B(i,j)))
|
if(boost::math::isnan(A(i,j)) ^ boost::math::isnan(B(i,j)))
|
||||||
return false;
|
return false;
|
||||||
else if(fabs(A(i,j) - B(i,j)) > tol)
|
else if(fabs(A(i,j) - B(i,j)) > tol)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,7 @@
|
||||||
#include <boost/random/variate_generator.hpp>
|
#include <boost/random/variate_generator.hpp>
|
||||||
|
|
||||||
#include <gtsam/base/Vector.h>
|
#include <gtsam/base/Vector.h>
|
||||||
|
#include <gtsam/base/types.h>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
@ -169,7 +170,7 @@ bool equal_with_abs_tol(const Vector& vec1, const Vector& vec2, double tol) {
|
||||||
if (vec1.size()!=vec2.size()) return false;
|
if (vec1.size()!=vec2.size()) return false;
|
||||||
size_t m = vec1.size();
|
size_t m = vec1.size();
|
||||||
for(size_t i=0; i<m; ++i) {
|
for(size_t i=0; i<m; ++i) {
|
||||||
if(isnan(vec1[i]) xor isnan(vec2[i]))
|
if(isnan(vec1[i]) ^ isnan(vec2[i]))
|
||||||
return false;
|
return false;
|
||||||
if(fabs(vec1[i] - vec2[i]) > tol)
|
if(fabs(vec1[i] - vec2[i]) > tol)
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -182,7 +183,7 @@ bool equal_with_abs_tol(const SubVector& vec1, const SubVector& vec2, double tol
|
||||||
if (vec1.size()!=vec2.size()) return false;
|
if (vec1.size()!=vec2.size()) return false;
|
||||||
size_t m = vec1.size();
|
size_t m = vec1.size();
|
||||||
for(size_t i=0; i<m; ++i) {
|
for(size_t i=0; i<m; ++i) {
|
||||||
if(isnan(vec1[i]) xor isnan(vec2[i]))
|
if(isnan(vec1[i]) ^ isnan(vec2[i]))
|
||||||
return false;
|
return false;
|
||||||
if(fabs(vec1[i] - vec2[i]) > tol)
|
if(fabs(vec1[i] - vec2[i]) > tol)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
* @date Nov 5, 2010
|
* @date Nov 5, 2010
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <boost/format.hpp>
|
||||||
|
#include <boost/bind.hpp>
|
||||||
|
|
||||||
#include <gtsam/base/debug.h>
|
#include <gtsam/base/debug.h>
|
||||||
#include <gtsam/base/cholesky.h>
|
#include <gtsam/base/cholesky.h>
|
||||||
#include <gtsam/base/timing.h>
|
#include <gtsam/base/timing.h>
|
||||||
|
|
@ -23,9 +27,6 @@
|
||||||
#include <gtsam/3rdparty/Eigen/Eigen/Core>
|
#include <gtsam/3rdparty/Eigen/Eigen/Core>
|
||||||
#include <gtsam/3rdparty/Eigen/Eigen/Dense>
|
#include <gtsam/3rdparty/Eigen/Eigen/Dense>
|
||||||
|
|
||||||
#include <boost/format.hpp>
|
|
||||||
#include <boost/bind.hpp>
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
@ -129,7 +130,7 @@ void choleskyPartial(Matrix& ABC, size_t nFrontal) {
|
||||||
tic(1, "lld");
|
tic(1, "lld");
|
||||||
ABC.block(0,0,nFrontal,nFrontal).triangularView<Eigen::Upper>() =
|
ABC.block(0,0,nFrontal,nFrontal).triangularView<Eigen::Upper>() =
|
||||||
ABC.block(0,0,nFrontal,nFrontal).selfadjointView<Eigen::Upper>().llt().matrixU();
|
ABC.block(0,0,nFrontal,nFrontal).selfadjointView<Eigen::Upper>().llt().matrixU();
|
||||||
assert(ABC.topLeftCorner(nFrontal,nFrontal).triangularView<Eigen::Upper>().toDenseMatrix().unaryExpr(&isfinite<double>).all());
|
assert(ABC.topLeftCorner(nFrontal,nFrontal).triangularView<Eigen::Upper>().toDenseMatrix().unaryExpr(ptr_fun(isfinite<double>)).all());
|
||||||
toc(1, "lld");
|
toc(1, "lld");
|
||||||
|
|
||||||
if(debug) cout << "R:\n" << Eigen::MatrixXd(ABC.topLeftCorner(nFrontal,nFrontal).triangularView<Eigen::Upper>()) << endl;
|
if(debug) cout << "R:\n" << Eigen::MatrixXd(ABC.topLeftCorner(nFrontal,nFrontal).triangularView<Eigen::Upper>()) << endl;
|
||||||
|
|
@ -140,7 +141,7 @@ void choleskyPartial(Matrix& ABC, size_t nFrontal) {
|
||||||
ABC.topLeftCorner(nFrontal,nFrontal).triangularView<Eigen::Upper>().transpose().solveInPlace(
|
ABC.topLeftCorner(nFrontal,nFrontal).triangularView<Eigen::Upper>().transpose().solveInPlace(
|
||||||
ABC.topRightCorner(nFrontal, n-nFrontal));
|
ABC.topRightCorner(nFrontal, n-nFrontal));
|
||||||
}
|
}
|
||||||
assert(ABC.topRightCorner(nFrontal, n-nFrontal).unaryExpr(&isfinite<double>).all());
|
assert(ABC.topRightCorner(nFrontal, n-nFrontal).unaryExpr(ptr_fun(isfinite<double>)).all());
|
||||||
if(debug) cout << "S:\n" << ABC.topRightCorner(nFrontal, n-nFrontal) << endl;
|
if(debug) cout << "S:\n" << ABC.topRightCorner(nFrontal, n-nFrontal) << endl;
|
||||||
toc(2, "compute S");
|
toc(2, "compute S");
|
||||||
|
|
||||||
|
|
@ -150,7 +151,7 @@ void choleskyPartial(Matrix& ABC, size_t nFrontal) {
|
||||||
if(n - nFrontal > 0)
|
if(n - nFrontal > 0)
|
||||||
ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>().rankUpdate(
|
ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>().rankUpdate(
|
||||||
ABC.topRightCorner(nFrontal, n-nFrontal).transpose(), -1.0);
|
ABC.topRightCorner(nFrontal, n-nFrontal).transpose(), -1.0);
|
||||||
assert(ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>().toDenseMatrix().unaryExpr(&isfinite<double>).all());
|
assert(ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>().toDenseMatrix().unaryExpr(ptr_fun(isfinite<double>)).all());
|
||||||
if(debug) cout << "L:\n" << Eigen::MatrixXd(ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>()) << endl;
|
if(debug) cout << "L:\n" << Eigen::MatrixXd(ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>()) << endl;
|
||||||
toc(3, "compute L");
|
toc(3, "compute L");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -241,9 +241,11 @@ void Timing::print() {
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double _tic_() {
|
double _tic_() {
|
||||||
struct timeval t;
|
typedef boost::chrono::high_resolution_clock clock_t;
|
||||||
gettimeofday(&t, NULL);
|
typedef boost::chrono::duration<double> duration_t;
|
||||||
return ((double)t.tv_sec + ((double)t.tv_usec)/1000000.);
|
|
||||||
|
clock_t::time_point t = clock_t::now();
|
||||||
|
return boost::chrono::duration_cast< duration_t >(t.time_since_epoch()).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <cstddef>
|
||||||
|
|
||||||
namespace gtsam {
|
namespace gtsam {
|
||||||
|
|
||||||
|
|
@ -71,3 +71,17 @@ namespace gtsam {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
|
||||||
|
#include <boost/math/special_functions/fpclassify.hpp>
|
||||||
|
using boost::math::isfinite;
|
||||||
|
using boost::math::isnan;
|
||||||
|
using boost::math::isinf;
|
||||||
|
|
||||||
|
#include <boost/math/constants/constants.hpp>
|
||||||
|
#ifndef M_PI
|
||||||
|
#define M_PI (boost::math::constants::pi<double>())
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue