diff --git a/appveyor.yml b/appveyor.yml index 29dc900..fa69e6b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,44 +1,43 @@ build: false -environment: +environment: matrix: - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda3 - + - PYTHON_VERSION: 3.5 MINICONDA: C:\Miniconda3-x64 - + - PYTHON_VERSION: 3.6 MINICONDA: C:\Miniconda3 - + - PYTHON_VERSION: 3.6 MINICONDA: C:\Miniconda3-x64 - + - PYTHON_VERSION: 3.7 MINICONDA: C:\Miniconda3 - + - PYTHON_VERSION: 3.7 MINICONDA: C:\Miniconda3-x64 -init: +init: - "ECHO %PYTHON_VERSION% %MINICONDA%" -install: - - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" +install: + - "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%PATH%" - python --version - python -c "import sys,platform,struct;print(sys.platform, platform.machine(), struct.calcsize('P') * 8, )" - - conda config --set always_yes yes --set changeps1 no - - conda update -q conda - - conda info -a - - "conda create -q -n test-environment - python=%PYTHON_VERSION% numpy pandas scipy matplotlib pytest" - - activate test-environment - - conda install libpython m2w64-toolchain cython + - conda config --set always_yes yes --set changeps1 no + - conda update -q conda + - conda info -a + - "conda create -q -n test-environment + python=%PYTHON_VERSION% numpy pandas scipy matplotlib pytest" + - activate test-environment + - conda install libpython cython - echo [build] > %CONDA_PREFIX%\Lib\distutils\distutils.cfg - - echo compiler = mingw32 >> %CONDA_PREFIX%\Lib\distutils\distutils.cfg - python setup.py install -test_script: +test_script: - pytest . after_test: diff --git a/ripser/ripser.cpp b/ripser/ripser.cpp index 23ea196..5694c2e 100644 --- a/ripser/ripser.cpp +++ b/ripser/ripser.cpp @@ -43,6 +43,7 @@ derivative works thereof, in binary and source code form. #include #include #include +#include #include #include #include @@ -50,6 +51,14 @@ derivative works thereof, in binary and source code form. #include +/* Disable packing for Windows */ +#if defined _WIN32 +#define PACK +#else +#define PACK __attribute__((__packed__)) +#endif + + template class hash_map : public std::unordered_map {}; typedef float value_t; typedef int64_t index_t; @@ -98,7 +107,7 @@ std::vector multiplicative_inverse_vector(const coefficient_t m) } #ifdef USE_COEFFICIENTS -struct __attribute__((packed)) entry_t { +struct PACK entry_t { index_t index : 8 * (sizeof(index_t) - sizeof(coefficient_t)); coefficient_t coefficient; entry_t(index_t _index, coefficient_t _coefficient) @@ -208,7 +217,7 @@ class sparse_distance_matrix { //Initialize from thresholded dense distance matrix template - sparse_distance_matrix(const DistanceMatrix& mat, value_t threshold) : + sparse_distance_matrix(const DistanceMatrix& mat, value_t threshold) : neighbors(mat.size()), vertex_births(mat.size(), 0) { for (size_t i = 0; i < size(); ++i) { for (size_t j = 0; j < size(); ++j) { @@ -219,7 +228,7 @@ class sparse_distance_matrix { } } //Initialize from COO format - sparse_distance_matrix(int* I, int* J, float* V, int NEdges, int N, float threshold) : + sparse_distance_matrix(int* I, int* J, float* V, int NEdges, int N, float threshold) : neighbors(N), vertex_births(N, 0) { int i, j; value_t val; @@ -819,7 +828,7 @@ template <> class ripser::simplex_coboundary_e public: simplex_coboundary_enumerator(const diameter_entry_t _simplex, index_t _dim, - const ripser& parent) + const ripser& parent) : idx_below(get_index(_simplex)), idx_above(0), v(parent.n - 1), k(_dim + 1), vertices(_dim + 1), simplex(_simplex), modulus(parent.modulus), dist(parent.dist), binomial_coeff(parent.binomial_coeff) { @@ -849,7 +858,7 @@ template <> class ripser::simplex_coboundary_e template <> class ripser::simplex_coboundary_enumerator { private: - const ripser& parent; + const ripser& parent; index_t idx_below, idx_above, v, k, max_vertex_below; const diameter_entry_t simplex; @@ -864,7 +873,7 @@ template <> class ripser::simplex_coboundary_enumerator public: simplex_coboundary_enumerator(const diameter_entry_t _simplex, index_t _dim, - const ripser& _parent) + const ripser& _parent) : parent(_parent), idx_below(get_index(_simplex)), idx_above(0), v(parent.n - 1), k(_dim + 1), max_vertex_below(parent.n - 1), simplex(_simplex), modulus(parent.modulus), dist(parent.dist), binomial_coeff(parent.binomial_coeff), vertices(parent.vertices), @@ -944,7 +953,7 @@ template <> std::vector ripser::get_ed template <> value_t ripser::get_vertex_birth(index_t i) { //TODO: Dummy for now; nonzero vertex births are only done through //sparse matrices at the moment - return 0.0; + return 0.0; } template <> value_t ripser::get_vertex_birth(index_t i) {