Skip to content

Commit

Permalink
Update fix compilaltion
Browse files Browse the repository at this point in the history
  • Loading branch information
aboulch committed Dec 17, 2018
1 parent 37da806 commit b024aa2
Show file tree
Hide file tree
Showing 95 changed files with 3,258 additions and 2,799 deletions.
19 changes: 9 additions & 10 deletions include/Normals.h → python/Normals.h
Expand Up @@ -30,8 +30,8 @@
#include <math.h>
#include <string>
#include <sstream>
#include "Eigen/Dense"
#include "nanoflann.hpp"
#include <Eigen/Dense>
#include <nanoflann.hpp>

#ifdef _OPENMP
#include <omp.h>
Expand Down Expand Up @@ -91,7 +91,6 @@ class Eigen_Normal_Estimator{

typedef nanoflann::KDTreeEigenMatrixAdaptor< Eigen::MatrixX3d > kd_tree; //a row is a point


// constructor
Eigen_Normal_Estimator(const Eigen::MatrixX3d& points, Eigen::MatrixX3d& normals):
pts(points),nls(normals){
Expand Down Expand Up @@ -128,7 +127,7 @@ class Eigen_Normal_Estimator{
}
istr.close();
pts.resize(points.size(),3);
for(int i=0; i<points.size(); i++){
for(uint i=0; i<points.size(); i++){
pts.row(i) = points[i];
}
}
Expand Down Expand Up @@ -159,7 +158,7 @@ class Eigen_Normal_Estimator{

//creating vector of random int
std::vector<int> vecInt(1000000);
for(int i=0; i<vecInt.size(); i++){
for(uint i=0; i<vecInt.size(); i++){
vecInt[i] = rand();
}

Expand Down Expand Up @@ -200,7 +199,7 @@ class Eigen_Normal_Estimator{

//kd tree creation
//build de kd_tree
kd_tree tree(pts);
kd_tree tree(3, pts, 10);
tree.index->buildIndex();

//create the density estimation for each point
Expand All @@ -218,7 +217,7 @@ class Eigen_Normal_Estimator{
//knn for k_density+1 because the point is itself include in the search tree
tree.index->knnSearch(&pt_query[0], k_density+1, &pointIdxSearch[0], &pointSquaredDistance[0]);
double d =0;
for(int i=0; i<pointSquaredDistance.size(); i++){
for(uint i=0; i<pointSquaredDistance.size(); i++){
d+=std::sqrt(pointSquaredDistance[i]);
}
d /= pointSquaredDistance.size()-1;
Expand Down Expand Up @@ -367,7 +366,7 @@ class Eigen_Normal_Estimator{
unsigned int dichotomic_search_nearest(const std::vector<double> elems, double d){
unsigned int i1 = 0;
unsigned int i2 = elems.size()-1;
unsigned int i3;
unsigned int i3 = (i1+i2)/2;
while(i2 > i1){
i3 = (i1+i2)/2;
if(elems[i3] == d){break;}
Expand All @@ -391,13 +390,13 @@ class Eigen_Normal_Estimator{
{
std::vector<double> dists;
double sum=0;
for(int i=0; i<pointIdxSearch.size(); i++){
for(uint i=0; i<pointIdxSearch.size(); i++){
sum+=densities[pointIdxSearch[i]];
dists.push_back(sum);
}

unsigned int S = vecRandInt.size();
unsigned int number_of_points = pointIdxSearch.size();
// unsigned int number_of_points = pointIdxSearch.size();
triplets.resize(triplet_number,3);
unsigned int pos=vecRandInt[0]%S;;
for(unsigned int i=0; i<triplet_number; i++){
Expand Down
2 changes: 1 addition & 1 deletion python/normEstHough.cxx
Expand Up @@ -69,7 +69,7 @@ void NormEstHough::get_normals(double* array, int m, int n) {
}
return ;
}

void NormEstHough::set_points(double* array, int m, int n){
// resize the point cloud
pts.resize(m,3);
Expand Down
11 changes: 6 additions & 5 deletions python/setup.py
Expand Up @@ -4,11 +4,12 @@


ext_modules = [Extension(
"NormalEstimatorHough",
sources=["NormalEstimatorHough.pyx", "normEstHough.cxx"],
include_dirs=["third_party_includes/", "../include"],
language="c++", # generate C++ code
extra_compile_args = ["-fopenmp", "-std=c++11"]
"NormalEstimatorHough",
sources=["NormalEstimatorHough.pyx", "normEstHough.cxx"],
include_dirs=["../third_party_includes/"],
language="c++", # generate C++ code
extra_compile_args = ["-fopenmp", "-std=c++11"],
extra_link_args=['-lgomp']
)]

setup(
Expand Down
5 changes: 5 additions & 0 deletions third_party_includes/Eigen/Cholesky
Expand Up @@ -9,6 +9,7 @@
#define EIGEN_CHOLESKY_MODULE_H

#include "Core"
#include "Jacobi"

#include "src/Core/util/DisableStupidWarnings.h"

Expand All @@ -31,7 +32,11 @@
#include "src/Cholesky/LLT.h"
#include "src/Cholesky/LDLT.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Cholesky/LLT_LAPACKE.h"
#endif

Expand Down
27 changes: 24 additions & 3 deletions third_party_includes/Eigen/Core
Expand Up @@ -14,6 +14,22 @@
// first thing Eigen does: stop the compiler from committing suicide
#include "src/Core/util/DisableStupidWarnings.h"

#if defined(__CUDACC__) && !defined(EIGEN_NO_CUDA)
#define EIGEN_CUDACC __CUDACC__
#endif

#if defined(__CUDA_ARCH__) && !defined(EIGEN_NO_CUDA)
#define EIGEN_CUDA_ARCH __CUDA_ARCH__
#endif

#if defined(__CUDACC_VER_MAJOR__) && (__CUDACC_VER_MAJOR__ >= 9)
#define EIGEN_CUDACC_VER ((__CUDACC_VER_MAJOR__ * 10000) + (__CUDACC_VER_MINOR__ * 100))
#elif defined(__CUDACC_VER__)
#define EIGEN_CUDACC_VER __CUDACC_VER__
#else
#define EIGEN_CUDACC_VER 0
#endif

// Handle NVCC/CUDA/SYCL
#if defined(__CUDACC__) || defined(__SYCL_DEVICE_ONLY__)
// Do not try asserts on CUDA and SYCL!
Expand All @@ -37,9 +53,9 @@
#endif

#define EIGEN_DEVICE_FUNC __host__ __device__
// We need math_functions.hpp to ensure that that EIGEN_USING_STD_MATH macro
// We need cuda_runtime.h to ensure that that EIGEN_USING_STD_MATH macro
// works properly on the device side
#include <math_functions.hpp>
#include <cuda_runtime.h>
#else
#define EIGEN_DEVICE_FUNC
#endif
Expand Down Expand Up @@ -155,6 +171,9 @@
#ifdef __AVX512DQ__
#define EIGEN_VECTORIZE_AVX512DQ
#endif
#ifdef __AVX512ER__
#define EIGEN_VECTORIZE_AVX512ER
#endif
#endif

// include files
Expand Down Expand Up @@ -229,7 +248,7 @@
#if defined __CUDACC__
#define EIGEN_VECTORIZE_CUDA
#include <vector_types.h>
#if defined __CUDACC_VER__ && __CUDACC_VER__ >= 70500
#if EIGEN_CUDACC_VER >= 70500
#define EIGEN_HAS_CUDA_FP16
#endif
#endif
Expand Down Expand Up @@ -352,6 +371,7 @@ using std::ptrdiff_t;
#include "src/Core/MathFunctions.h"
#include "src/Core/GenericPacketMath.h"
#include "src/Core/MathFunctionsImpl.h"
#include "src/Core/arch/Default/ConjHelper.h"

#if defined EIGEN_VECTORIZE_AVX512
#include "src/Core/arch/SSE/PacketMath.h"
Expand All @@ -367,6 +387,7 @@ using std::ptrdiff_t;
#include "src/Core/arch/AVX/MathFunctions.h"
#include "src/Core/arch/AVX/Complex.h"
#include "src/Core/arch/AVX/TypeCasting.h"
#include "src/Core/arch/SSE/TypeCasting.h"
#elif defined EIGEN_VECTORIZE_SSE
#include "src/Core/arch/SSE/PacketMath.h"
#include "src/Core/arch/SSE/MathFunctions.h"
Expand Down
4 changes: 4 additions & 0 deletions third_party_includes/Eigen/Eigenvalues
Expand Up @@ -45,7 +45,11 @@
#include "src/Eigenvalues/GeneralizedEigenSolver.h"
#include "src/Eigenvalues/MatrixBaseEigenvalues.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/Eigenvalues/RealSchur_LAPACKE.h"
#include "src/Eigenvalues/ComplexSchur_LAPACKE.h"
#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h"
Expand Down
4 changes: 4 additions & 0 deletions third_party_includes/Eigen/LU
Expand Up @@ -28,7 +28,11 @@
#include "src/LU/FullPivLU.h"
#include "src/LU/PartialPivLU.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/LU/PartialPivLU_LAPACKE.h"
#endif
#include "src/LU/Determinant.h"
Expand Down
4 changes: 4 additions & 0 deletions third_party_includes/Eigen/QR
Expand Up @@ -36,7 +36,11 @@
#include "src/QR/ColPivHouseholderQR.h"
#include "src/QR/CompleteOrthogonalDecomposition.h"
#ifdef EIGEN_USE_LAPACKE
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/QR/HouseholderQR_LAPACKE.h"
#include "src/QR/ColPivHouseholderQR_LAPACKE.h"
#endif
Expand Down
2 changes: 1 addition & 1 deletion third_party_includes/Eigen/QtAlignedMalloc
Expand Up @@ -27,7 +27,7 @@ void qFree(void *ptr)
void *qRealloc(void *ptr, std::size_t size)
{
void* newPtr = Eigen::internal::aligned_malloc(size);
memcpy(newPtr, ptr, size);
std::memcpy(newPtr, ptr, size);
Eigen::internal::aligned_free(ptr);
return newPtr;
}
Expand Down
4 changes: 4 additions & 0 deletions third_party_includes/Eigen/SVD
Expand Up @@ -37,7 +37,11 @@
#include "src/SVD/JacobiSVD.h"
#include "src/SVD/BDCSVD.h"
#if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT)
#ifdef EIGEN_USE_MKL
#include "mkl_lapacke.h"
#else
#include "src/misc/lapacke.h"
#endif
#include "src/SVD/JacobiSVD_LAPACKE.h"
#endif

Expand Down
14 changes: 9 additions & 5 deletions third_party_includes/Eigen/src/Cholesky/LDLT.h
Expand Up @@ -248,7 +248,7 @@ template<typename _MatrixType, int _UpLo> class LDLT
/** \brief Reports whether previous computation was successful.
*
* \returns \c Success if computation was succesful,
* \c NumericalIssue if the matrix.appears to be negative.
* \c NumericalIssue if the factorization failed because of a zero pivot.
*/
ComputationInfo info() const
{
Expand Down Expand Up @@ -305,7 +305,8 @@ template<> struct ldlt_inplace<Lower>
if (size <= 1)
{
transpositions.setIdentity();
if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
if(size==0) sign = ZeroSign;
else if (numext::real(mat.coeff(0,0)) > static_cast<RealScalar>(0) ) sign = PositiveSemiDef;
else if (numext::real(mat.coeff(0,0)) < static_cast<RealScalar>(0)) sign = NegativeSemiDef;
else sign = ZeroSign;
return true;
Expand Down Expand Up @@ -376,6 +377,8 @@ template<> struct ldlt_inplace<Lower>

if((rs>0) && pivot_is_valid)
A21 /= realAkk;
else if(rs>0)
ret = ret && (A21.array()==Scalar(0)).all();

if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed
else if(!pivot_is_valid) found_zero_pivot = true;
Expand Down Expand Up @@ -568,13 +571,14 @@ void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) cons
// more precisely, use pseudo-inverse of D (see bug 241)
using std::abs;
const typename Diagonal<const MatrixType>::RealReturnType vecD(vectorD());
// In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon
// as motivated by LAPACK's xGELSS:
// In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min())
// and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS:
// RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits<RealScalar>::epsilon(),RealScalar(1) / NumTraits<RealScalar>::highest());
// However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest
// diagonal element is not well justified and leads to numerical issues in some cases.
// Moreover, Lapack's xSYTRS routines use 0 for the tolerance.
RealScalar tolerance = RealScalar(1) / NumTraits<RealScalar>::highest();
// Using numeric_limits::min() gives us more robustness to denormals.
RealScalar tolerance = (std::numeric_limits<RealScalar>::min)();

for (Index i = 0; i < vecD.size(); ++i)
{
Expand Down
26 changes: 17 additions & 9 deletions third_party_includes/Eigen/src/Cholesky/LLT.h
Expand Up @@ -24,7 +24,7 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
*
* \tparam _MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition
* \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper.
* The other triangular part won't be read.
* The other triangular part won't be read.
*
* This class performs a LL^T Cholesky decomposition of a symmetric, positive definite
* matrix A such that A = LL^* = U^*U, where L is lower triangular.
Expand All @@ -41,14 +41,18 @@ template<typename MatrixType, int UpLo> struct LLT_Traits;
* Example: \include LLT_example.cpp
* Output: \verbinclude LLT_example.out
*
* \b Performance: for best performance, it is recommended to use a column-major storage format
* with the Lower triangular part (the default), or, equivalently, a row-major storage format
* with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization
* step, and rank-updates can be up to 3 times slower.
*
* This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism.
*
* Note that during the decomposition, only the lower (or upper, as defined by _UpLo) triangular part of A is considered.
* Therefore, the strict lower part does not have to store correct values.
*
* \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT
*/
/* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH)
* Note that during the decomposition, only the upper triangular part of A is considered. Therefore,
* the strict lower part does not have to store correct values.
*/
template<typename _MatrixType, int _UpLo> class LLT
{
public:
Expand Down Expand Up @@ -146,7 +150,7 @@ template<typename _MatrixType, int _UpLo> class LLT
}

template<typename Derived>
void solveInPlace(MatrixBase<Derived> &bAndX) const;
void solveInPlace(const MatrixBase<Derived> &bAndX) const;

template<typename InputType>
LLT& compute(const EigenBase<InputType>& matrix);
Expand Down Expand Up @@ -177,7 +181,7 @@ template<typename _MatrixType, int _UpLo> class LLT
/** \brief Reports whether previous computation was successful.
*
* \returns \c Success if computation was succesful,
* \c NumericalIssue if the matrix.appears to be negative.
* \c NumericalIssue if the matrix.appears not to be positive definite.
*/
ComputationInfo info() const
{
Expand Down Expand Up @@ -425,7 +429,8 @@ LLT<MatrixType,_UpLo>& LLT<MatrixType,_UpLo>::compute(const EigenBase<InputType>
eigen_assert(a.rows()==a.cols());
const Index size = a.rows();
m_matrix.resize(size, size);
m_matrix = a.derived();
if (!internal::is_same_dense(m_matrix, a.derived()))
m_matrix = a.derived();

// Compute matrix L1 norm = max abs column sum.
m_l1_norm = RealScalar(0);
Expand Down Expand Up @@ -485,11 +490,14 @@ void LLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const
*
* This version avoids a copy when the right hand side matrix b is not needed anymore.
*
* \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here.
* This function will const_cast it, so constness isn't honored here.
*
* \sa LLT::solve(), MatrixBase::llt()
*/
template<typename MatrixType, int _UpLo>
template<typename Derived>
void LLT<MatrixType,_UpLo>::solveInPlace(MatrixBase<Derived> &bAndX) const
void LLT<MatrixType,_UpLo>::solveInPlace(const MatrixBase<Derived> &bAndX) const
{
eigen_assert(m_isInitialized && "LLT is not initialized.");
eigen_assert(m_matrix.rows()==bAndX.rows());
Expand Down
2 changes: 0 additions & 2 deletions third_party_includes/Eigen/src/Core/Array.h
Expand Up @@ -153,8 +153,6 @@ class Array
: Base(std::move(other))
{
Base::_check_template_params();
if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic)
Base::_set_noalias(other);
}
EIGEN_DEVICE_FUNC
Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable<Scalar>::value)
Expand Down

0 comments on commit b024aa2

Please sign in to comment.