Initial changes to compile on windows

release/4.3a0
Richard Roberts 2012-05-22 22:52:08 +00:00
parent 2060f1dd22
commit 25a53815e0
7 changed files with 34 additions and 14 deletions

View File

@ -50,7 +50,7 @@ public:
* Destroy and deallocate this object, only if it was originally allocated using clone_().
*/
virtual void deallocate_() const {
this->~Value();
this->Value::~Value();
boost::singleton_pool<PoolTag, sizeof(DERIVED)>::free((void*)this);
}

View File

@ -15,6 +15,7 @@
* @author Christian Potthast
*/
#include <gtsam/base/types.h>
#include <gtsam/base/Matrix.h>
#include <gtsam/base/timing.h>
#include <gtsam/base/Vector.h>

View File

@ -26,6 +26,7 @@
#include <gtsam/3rdparty/Eigen/Eigen/QR>
#include <boost/format.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/math/special_functions/fpclassify.hpp>
/**
* 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 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;
else if(fabs(A(i,j) - B(i,j)) > tol)
return false;

View File

@ -35,6 +35,7 @@
#include <boost/random/variate_generator.hpp>
#include <gtsam/base/Vector.h>
#include <gtsam/base/types.h>
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;
size_t m = vec1.size();
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;
if(fabs(vec1[i] - vec2[i]) > tol)
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;
size_t m = vec1.size();
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;
if(fabs(vec1[i] - vec2[i]) > tol)
return false;

View File

@ -16,6 +16,10 @@
* @date Nov 5, 2010
*/
#include <functional>
#include <boost/format.hpp>
#include <boost/bind.hpp>
#include <gtsam/base/debug.h>
#include <gtsam/base/cholesky.h>
#include <gtsam/base/timing.h>
@ -23,9 +27,6 @@
#include <gtsam/3rdparty/Eigen/Eigen/Core>
#include <gtsam/3rdparty/Eigen/Eigen/Dense>
#include <boost/format.hpp>
#include <boost/bind.hpp>
using namespace std;
namespace gtsam {
@ -129,7 +130,7 @@ void choleskyPartial(Matrix& ABC, size_t nFrontal) {
tic(1, "lld");
ABC.block(0,0,nFrontal,nFrontal).triangularView<Eigen::Upper>() =
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");
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.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;
toc(2, "compute S");
@ -150,7 +151,7 @@ void choleskyPartial(Matrix& ABC, size_t nFrontal) {
if(n - nFrontal > 0)
ABC.bottomRightCorner(n-nFrontal,n-nFrontal).selfadjointView<Eigen::Upper>().rankUpdate(
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;
toc(3, "compute L");
}

View File

@ -241,9 +241,11 @@ void Timing::print() {
/* ************************************************************************* */
double _tic_() {
struct timeval t;
gettimeofday(&t, NULL);
return ((double)t.tv_sec + ((double)t.tv_usec)/1000000.);
typedef boost::chrono::high_resolution_clock clock_t;
typedef boost::chrono::duration<double> duration_t;
clock_t::time_point t = clock_t::now();
return boost::chrono::duration_cast< duration_t >(t.time_since_epoch()).count();
}
/* ************************************************************************* */

View File

@ -19,7 +19,7 @@
#pragma once
#include <unistd.h>
#include <cstddef>
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