From 7755e6d59ce4763ea70b300dc4a17a4910bc550a Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Wed, 9 Oct 2024 22:15:07 +0200 Subject: [PATCH 1/7] Build with 2024.10.01 images and test 3.13 for pip linux --- .circleci/config.yml | 30 +++++++++++------------ .github/workflows/pip-build-linux.yml | 28 ++++++++++----------- .github/workflows/pip-packaging-linux.yml | 21 +++++++++++++++- 3 files changed, 49 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1dbd459a57..9bd2f4fc72 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ jobs: examples: docker: # cf. https://github.com/GUDHI/gudhi-deploy/blob/main/Dockerfile_for_circleci_image - - image: gudhi/ci_for_gudhi:2024.09.01 + - image: gudhi/ci_for_gudhi:2024.10.01 steps: - checkout - run: @@ -24,7 +24,7 @@ jobs: tests: docker: - - image: gudhi/ci_for_gudhi:2024.09.01 + - image: gudhi/ci_for_gudhi:2024.10.01 steps: - checkout - run: @@ -43,7 +43,7 @@ jobs: debug_tests: docker: - - image: gudhi/ci_for_gudhi:2024.09.01 + - image: gudhi/ci_for_gudhi:2024.10.01 steps: - checkout - run: @@ -62,7 +62,7 @@ jobs: utils: docker: - - image: gudhi/ci_for_gudhi:2024.09.01 + - image: gudhi/ci_for_gudhi:2024.10.01 steps: - checkout - run: @@ -81,7 +81,7 @@ jobs: python: docker: - - image: gudhi/ci_for_gudhi:2024.09.01 + - image: gudhi/ci_for_gudhi:2024.10.01 resource_class: large # Delaunay complex requires about 5 Gb of RAM to compile steps: - checkout @@ -117,7 +117,7 @@ jobs: doxygen: docker: - - image: gudhi/doxygen_for_gudhi:2024.06.01 + - image: gudhi/doxygen_for_gudhi:2024.10.01 steps: - checkout - run: @@ -147,7 +147,7 @@ jobs: bibliography: docker: - - image: gudhi/doxygen_for_gudhi:2024.06.01 + - image: gudhi/doxygen_for_gudhi:2024.10.01 steps: - checkout - run: @@ -170,7 +170,7 @@ jobs: examples_without_cgal_eigen: docker: # cf. https://github.com/GUDHI/gudhi-deploy/blob/main/Dockerfile_for_circleci_image_without_cgal - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -189,7 +189,7 @@ jobs: tests_without_cgal_eigen: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -208,7 +208,7 @@ jobs: utils_without_cgal_eigen: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -227,7 +227,7 @@ jobs: python_without_cgal_eigen: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -249,7 +249,7 @@ jobs: examples_without_cgal: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -268,7 +268,7 @@ jobs: tests_without_cgal: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -287,7 +287,7 @@ jobs: utils_without_cgal: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: @@ -306,7 +306,7 @@ jobs: python_without_cgal: docker: - - image: gudhi/ci_for_gudhi_wo_cgal:2024.06.01 + - image: gudhi/ci_for_gudhi_wo_cgal:2024.10.01 steps: - checkout - run: diff --git a/.github/workflows/pip-build-linux.yml b/.github/workflows/pip-build-linux.yml index 628dd4b6b1..742bd660f0 100644 --- a/.github/workflows/pip-build-linux.yml +++ b/.github/workflows/pip-build-linux.yml @@ -11,31 +11,31 @@ jobs: name: build pip wheel runs-on: ubuntu-latest # cf. https://github.com/GUDHI/gudhi-deploy/blob/main/Dockerfile_for_pip - container: gudhi/pip_for_gudhi:2024.06.02 + container: gudhi/pip_for_gudhi:2024.10.01 steps: # Should use actions/checkout@v4, but requires node20, not available for quay.io/pypa/manylinux2014_x86_64 - uses: actions/checkout@v3 with: submodules: true - - name: Build wheel for Python 3.9 + - name: Build wheel for Python 3.13 run: | - mkdir build_39 - cd build_39 + mkdir build_313 + cd build_313 cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON39/bin/python .. cd src/python - $PYTHON39/bin/python -m build -n -w + $PYTHON313/bin/python -m build -n -w auditwheel repair dist/*.whl # NumPy 2.X is installed and guarantees ABI compatibility, test it with the minimal numpy version for python version - - name: Install and test wheel for Python 3.9 + - name: Install and test wheel for Python 3.13 run: | - $PYTHON39/bin/python -m pip install --user pytest build_39/src/python/dist/*.whl - $PYTHON39/bin/python -m pip install numpy~=1.19.3 - $PYTHON39/bin/python -c "import gudhi; print(gudhi.__version__)" - $PYTHON39/bin/python -m pytest -v src/python/test/test_alpha_complex.py - $PYTHON39/bin/python -m pytest -v src/python/test/test_delaunay_complex.py - $PYTHON39/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py - $PYTHON39/bin/python -m pytest -v src/python/test/test_cubical_complex.py - $PYTHON39/bin/python -m pytest -v src/python/test/test_rips_complex.py + $PYTHON313/bin/python -m pip install --user pytest build_313/src/python/dist/*.whl + $PYTHON313/bin/python -m pip install numpy~=2.1.2 + $PYTHON313/bin/python -c "import gudhi; print(gudhi.__version__)" + $PYTHON313/bin/python -m pytest -v src/python/test/test_alpha_complex.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_delaunay_complex.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_cubical_complex.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Upload linux python wheel # Should use actions/upload-artifact@v4, but requires node20, not available for quay.io/pypa/manylinux2014_x86_64 uses: actions/upload-artifact@v3 diff --git a/.github/workflows/pip-packaging-linux.yml b/.github/workflows/pip-packaging-linux.yml index f93d4fbf85..51c20d31a0 100644 --- a/.github/workflows/pip-packaging-linux.yml +++ b/.github/workflows/pip-packaging-linux.yml @@ -9,7 +9,7 @@ jobs: name: build pip wheel runs-on: ubuntu-latest # cf. https://github.com/GUDHI/gudhi-deploy/blob/main/Dockerfile_for_pip - container: gudhi/pip_for_gudhi:2024.06.02 + container: gudhi/pip_for_gudhi:2024.10.01 steps: # Should use actions/checkout@v4, but requires node20, not available for quay.io/pypa/manylinux2014_x86_64 - uses: actions/checkout@v3 @@ -111,6 +111,24 @@ jobs: $PYTHON312/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py $PYTHON312/bin/python -m pytest -v src/python/test/test_cubical_complex.py $PYTHON312/bin/python -m pytest -v src/python/test/test_rips_complex.py + - name: Build wheel for Python 3.13 + run: | + mkdir build_313 + cd build_313 + cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON313/bin/python .. + cd src/python + $PYTHON313/bin/python -m build -n -w + auditwheel repair dist/*.whl + - name: Install and test wheel for Python 3.13 + run: | + $PYTHON313/bin/python -m pip install --user pytest build_313/src/python/dist/*.whl + $PYTHON313/bin/python -m pip install numpy~=1.26.0 + $PYTHON313/bin/python -c "import gudhi; print(gudhi.__version__)" + $PYTHON313/bin/python -m pytest -v src/python/test/test_alpha_complex.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_delaunay_complex.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_cubical_complex.py + $PYTHON313/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Publish on PyPi env: TWINE_USERNAME: __token__ @@ -121,3 +139,4 @@ jobs: $PYTHON38/bin/python -m twine upload build_310/src/python/wheelhouse/*.whl $PYTHON38/bin/python -m twine upload build_311/src/python/wheelhouse/*.whl $PYTHON38/bin/python -m twine upload build_312/src/python/wheelhouse/*.whl + $PYTHON38/bin/python -m twine upload build_313/src/python/wheelhouse/*.whl From d23a1052c7dd138b2efaf0946ab2f0132a067e31 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Thu, 10 Oct 2024 08:41:01 +0200 Subject: [PATCH 2/7] requires docker to be updated with python 3.13 and its requirements --- .github/workflows/pip-build-linux.yml | 6 +++--- .github/workflows/pip-packaging-linux.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pip-build-linux.yml b/.github/workflows/pip-build-linux.yml index 742bd660f0..7026bbdcb0 100644 --- a/.github/workflows/pip-build-linux.yml +++ b/.github/workflows/pip-build-linux.yml @@ -11,7 +11,7 @@ jobs: name: build pip wheel runs-on: ubuntu-latest # cf. https://github.com/GUDHI/gudhi-deploy/blob/main/Dockerfile_for_pip - container: gudhi/pip_for_gudhi:2024.10.01 + container: gudhi/pip_for_gudhi:2024.10.02 steps: # Should use actions/checkout@v4, but requires node20, not available for quay.io/pypa/manylinux2014_x86_64 - uses: actions/checkout@v3 @@ -21,7 +21,7 @@ jobs: run: | mkdir build_313 cd build_313 - cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON39/bin/python .. + cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON313/bin/python .. cd src/python $PYTHON313/bin/python -m build -n -w auditwheel repair dist/*.whl @@ -41,4 +41,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: linux python wheel - path: build_39/src/python/wheelhouse/*.whl + path: build_313/src/python/wheelhouse/*.whl diff --git a/.github/workflows/pip-packaging-linux.yml b/.github/workflows/pip-packaging-linux.yml index 51c20d31a0..a649baa038 100644 --- a/.github/workflows/pip-packaging-linux.yml +++ b/.github/workflows/pip-packaging-linux.yml @@ -9,7 +9,7 @@ jobs: name: build pip wheel runs-on: ubuntu-latest # cf. https://github.com/GUDHI/gudhi-deploy/blob/main/Dockerfile_for_pip - container: gudhi/pip_for_gudhi:2024.10.01 + container: gudhi/pip_for_gudhi:2024.10.02 steps: # Should use actions/checkout@v4, but requires node20, not available for quay.io/pypa/manylinux2014_x86_64 - uses: actions/checkout@v3 From 795c23515aff418750fd6156315cce68fff295b5 Mon Sep 17 00:00:00 2001 From: hschreiber Date: Wed, 6 Nov 2024 14:44:57 +0100 Subject: [PATCH 3/7] bug fix in R reduction + print fix --- .../gudhi/Persistence_matrix/Chain_matrix.h | 24 +- .../gudhi/Persistence_matrix/base_pairing.h | 23 +- src/Persistence_matrix/test/pm_matrix_tests.h | 225 +++++++++++++++++- 3 files changed, 249 insertions(+), 23 deletions(-) diff --git a/src/Persistence_matrix/include/gudhi/Persistence_matrix/Chain_matrix.h b/src/Persistence_matrix/include/gudhi/Persistence_matrix/Chain_matrix.h index 7611990b82..dce0a1d504 100644 --- a/src/Persistence_matrix/include/gudhi/Persistence_matrix/Chain_matrix.h +++ b/src/Persistence_matrix/include/gudhi/Persistence_matrix/Chain_matrix.h @@ -913,24 +913,28 @@ inline void Chain_matrix::print() const { std::cout << "Column Matrix:\n"; if constexpr (!Master_matrix::Option_list::has_map_column_container) { - for (ID_index i = 0; i < pivotToColumnIndex_.size() && pivotToColumnIndex_[i] != static_cast(-1); ++i) { + for (ID_index i = 0; i < pivotToColumnIndex_.size(); ++i) { Index pos = pivotToColumnIndex_[i]; - const Column& col = matrix_[pos]; - for (const auto& entry : col) { - std::cout << entry.get_row_index() << " "; + if (pos != static_cast(-1)){ + const Column& col = matrix_[pos]; + for (const auto& entry : col) { + std::cout << entry.get_row_index() << " "; + } + std::cout << "(" << i << ", " << pos << ")\n"; } - std::cout << "(" << i << ", " << pos << ")\n"; } if constexpr (Master_matrix::Option_list::has_row_access) { std::cout << "\n"; std::cout << "Row Matrix:\n"; - for (ID_index i = 0; i < pivotToColumnIndex_.size() && pivotToColumnIndex_[i] != static_cast(-1); ++i) { + for (ID_index i = 0; i < pivotToColumnIndex_.size(); ++i) { Index pos = pivotToColumnIndex_[i]; - const Row& row = RA_opt::get_row(pos); - for (const auto& entry : row) { - std::cout << entry.get_column_index() << " "; + if (pos != static_cast(-1)){ + const Row& row = RA_opt::get_row(pos); + for (const auto& entry : row) { + std::cout << entry.get_column_index() << " "; + } + std::cout << "(" << i << ", " << pos << ")\n"; } - std::cout << "(" << i << ", " << pos << ")\n"; } } } else { diff --git a/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h b/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h index 8ce95ce743..780040f011 100644 --- a/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h +++ b/src/Persistence_matrix/include/gudhi/Persistence_matrix/base_pairing.h @@ -132,10 +132,11 @@ inline const typename Base_pairing::Barcode& Base_pairing inline void Base_pairing::_reduce() { - std::unordered_map pivotsToColumn(_matrix()->get_number_of_columns()); + std::unordered_map negativeColumns(_matrix()->get_number_of_columns()); auto dim = _matrix()->get_max_dimension(); std::vector > columnsByDim(dim + 1); + for (auto& v : columnsByDim) v.reserve(_matrix()->get_number_of_columns()); for (unsigned int i = 0; i < _matrix()->get_number_of_columns(); i++) { columnsByDim[dim - _matrix()->get_column_dimension(i)].push_back(i); } @@ -144,17 +145,21 @@ inline void Base_pairing::_reduce() for (Index i : cols) { auto& curr = _matrix()->get_column(i); if (curr.is_empty()) { - if (pivotsToColumn.find(i) == pivotsToColumn.end()) { + if (negativeColumns.find(i) == negativeColumns.end()) { barcode_.emplace_back(i, -1, dim); } } else { ID_index pivot = curr.get_pivot(); + auto it = idToPosition_.find(pivot); + Index pivotColumnNumber = it == idToPosition_.end() ? pivot : it->second; + auto itNeg = negativeColumns.find(pivotColumnNumber); + Index pivotKiller = itNeg == negativeColumns.end() ? -1 : itNeg->second; - while (pivot != static_cast(-1) && pivotsToColumn.find(pivot) != pivotsToColumn.end()) { + while (pivot != static_cast(-1) && pivotKiller != static_cast(-1)) { if constexpr (Master_matrix::Option_list::is_z2) { - curr += _matrix()->get_column(pivotsToColumn.at(pivot)); + curr += _matrix()->get_column(pivotKiller); } else { - auto& toadd = _matrix()->get_column(pivotsToColumn.at(pivot)); + auto& toadd = _matrix()->get_column(pivotKiller); typename Master_matrix::Element coef = toadd.get_pivot_value(); auto& operators = _matrix()->colSettings_->operators; coef = operators.get_inverse(coef); @@ -163,12 +168,14 @@ inline void Base_pairing::_reduce() } pivot = curr.get_pivot(); + it = idToPosition_.find(pivot); + pivotColumnNumber = it == idToPosition_.end() ? pivot : it->second; + itNeg = negativeColumns.find(pivotColumnNumber); + pivotKiller = itNeg == negativeColumns.end() ? -1 : itNeg->second; } if (pivot != static_cast(-1)) { - pivotsToColumn.emplace(pivot, i); - auto it = idToPosition_.find(pivot); - auto pivotColumnNumber = it == idToPosition_.end() ? pivot : it->second; + negativeColumns.emplace(pivotColumnNumber, i); _matrix()->get_column(pivotColumnNumber).clear(); barcode_.emplace_back(pivotColumnNumber, i, dim - 1); } else { diff --git a/src/Persistence_matrix/test/pm_matrix_tests.h b/src/Persistence_matrix/test/pm_matrix_tests.h index 3d0aac966e..0028079c57 100644 --- a/src/Persistence_matrix/test/pm_matrix_tests.h +++ b/src/Persistence_matrix/test/pm_matrix_tests.h @@ -1348,8 +1348,9 @@ template void test_barcode() { struct BarComp { bool operator()(const std::tuple& c1, const std::tuple& c2) const { - if (std::get<0>(c1) == std::get<0>(c2)) return std::get<1>(c1) < std::get<1>(c2); - return std::get<0>(c1) < std::get<0>(c2); + if (std::get<0>(c1) != std::get<0>(c2)) return std::get<0>(c1) < std::get<0>(c2); + if (std::get<1>(c1) != std::get<1>(c2)) return std::get<1>(c1) < std::get<1>(c2); + return std::get<2>(c1) < std::get<2>(c2); } }; @@ -1420,12 +1421,220 @@ void test_barcode() { } template -void test_shifted_barcode() { +void test_shifted_barcode1() { + using C = typename Matrix::Column; + struct BarComp { + bool operator()(const std::tuple& c1, const std::tuple& c2) const { + if (std::get<0>(c1) != std::get<0>(c2)) return std::get<0>(c1) < std::get<0>(c2); + if (std::get<1>(c1) != std::get<1>(c2)) return std::get<1>(c1) < std::get<1>(c2); + return std::get<2>(c1) < std::get<2>(c2); + } + }; + + Matrix m(17, 2); + if constexpr (is_z2()) { + m.insert_boundary(0, {}, 0); + m.insert_boundary(1, {}, 0); + m.insert_boundary(2, {}, 0); + m.insert_boundary(3, {}, 0); + m.insert_boundary(4, {}, 0); + m.insert_boundary(5, {}, 0); + m.insert_boundary(6, {}, 0); + m.insert_boundary(10, {0, 1}, 1); + m.insert_boundary(11, {1, 3}, 1); + m.insert_boundary(12, {2, 3}, 1); + m.insert_boundary(13, {2, 4}, 1); + m.insert_boundary(14, {3, 4}, 1); + m.insert_boundary(15, {2, 6}, 1); + m.insert_boundary(16, {4, 6}, 1); + m.insert_boundary(17, {5, 6}, 1); + m.insert_boundary(30, {12, 13, 14}, 2); + m.insert_boundary(31, {13, 15, 16}, 2); + } else { + m.insert_boundary(0, {}, 0); + m.insert_boundary(1, {}, 0); + m.insert_boundary(2, {}, 0); + m.insert_boundary(3, {}, 0); + m.insert_boundary(4, {}, 0); + m.insert_boundary(5, {}, 0); + m.insert_boundary(6, {}, 0); + m.insert_boundary(10, {{0, 1}, {1, 1}}, 1); + m.insert_boundary(11, {{1, 1}, {3, 1}}, 1); + m.insert_boundary(12, {{2, 1}, {3, 1}}, 1); + m.insert_boundary(13, {{2, 1}, {4, 1}}, 1); + m.insert_boundary(14, {{3, 1}, {4, 1}}, 1); + m.insert_boundary(15, {{2, 1}, {6, 1}}, 1); + m.insert_boundary(16, {{4, 1}, {6, 1}}, 1); + m.insert_boundary(17, {{5, 1}, {6, 1}}, 1); + m.insert_boundary(30, {{12, 1}, {13, 1}, {14, 1}}, 2); + m.insert_boundary(31, {{13, 1}, {15, 1}, {16, 1}}, 2); + } + + const auto& barcode = m.get_current_barcode(); + + std::vector > reducedMatrix; + if constexpr (is_z2()) { + if constexpr (Matrix::Option_list::is_of_boundary_type) { + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.push_back({0, 1}); + reducedMatrix.push_back({1, 3}); + reducedMatrix.push_back({1, 2}); + reducedMatrix.push_back({2, 4}); + reducedMatrix.emplace_back(); + reducedMatrix.push_back({2, 6}); + reducedMatrix.emplace_back(); + reducedMatrix.push_back({2, 5}); + reducedMatrix.push_back({12, 13, 14}); + reducedMatrix.push_back({13, 15, 16}); + } else { + reducedMatrix.push_back({0}); + reducedMatrix.push_back({0, 1}); + reducedMatrix.push_back({0, 2}); + reducedMatrix.push_back({0, 3}); + reducedMatrix.push_back({0, 4}); + reducedMatrix.push_back({0, 5}); + reducedMatrix.push_back({0, 6}); + reducedMatrix.push_back({10}); + reducedMatrix.push_back({10, 11}); + reducedMatrix.push_back({10, 11, 12}); + reducedMatrix.push_back({10, 11, 12, 13}); + reducedMatrix.push_back({12, 13, 14}); + reducedMatrix.push_back({10, 11, 12, 15}); + reducedMatrix.push_back({13, 15, 16}); + reducedMatrix.push_back({10, 11, 12, 15, 17}); + reducedMatrix.push_back({30}); + reducedMatrix.push_back({31}); + } + } else { + if constexpr (Matrix::Option_list::is_of_boundary_type) { + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.emplace_back(); + reducedMatrix.push_back({{0, 1}, {1, 1}}); + reducedMatrix.push_back({{1, 1}, {3, 1}}); + reducedMatrix.push_back({{1, 1}, {2, 1}}); + reducedMatrix.push_back({{2, 1}, {4, 1}}); + reducedMatrix.emplace_back(); + reducedMatrix.push_back({{2, 1}, {6, 1}}); + reducedMatrix.emplace_back(); + reducedMatrix.push_back({{2, 1}, {5, 1}}); + reducedMatrix.push_back({{12, 1}, {13, 1}, {14, 1}}); + reducedMatrix.push_back({{13, 1}, {15, 1}, {16, 1}}); + } else { + reducedMatrix.push_back({{0, 1}}); + reducedMatrix.push_back({{0, 1}, {1, 1}}); + reducedMatrix.push_back({{0, 1}, {2, 1}}); + reducedMatrix.push_back({{0, 1}, {3, 1}}); + reducedMatrix.push_back({{0, 1}, {4, 1}}); + reducedMatrix.push_back({{0, 1}, {5, 1}}); + reducedMatrix.push_back({{0, 1}, {6, 1}}); + reducedMatrix.push_back({{10, 1}}); + reducedMatrix.push_back({{10, 1}, {11, 1}}); + reducedMatrix.push_back({{10, 1}, {11, 1}, {12, 1}}); + reducedMatrix.push_back({{10, 1}, {11, 1}, {12, 1}, {13, 1}}); + reducedMatrix.push_back({{12, 1}, {13, 1}, {14, 1}}); + reducedMatrix.push_back({{10, 1}, {11, 1}, {12, 1}, {15, 1}}); + reducedMatrix.push_back({{13, 1}, {15, 1}, {16, 1}}); + reducedMatrix.push_back({{10, 1}, {11, 1}, {12, 1}, {15, 1}, {17, 1}}); + reducedMatrix.push_back({{30, 1}}); + reducedMatrix.push_back({{31, 1}}); + } + } + + if constexpr (Matrix::Option_list::column_indexation_type == Column_indexation_types::IDENTIFIER){ + test_column_equality(reducedMatrix[0], get_column_content_via_iterators(m.get_column(0))); + test_column_equality(reducedMatrix[1], get_column_content_via_iterators(m.get_column(1))); + test_column_equality(reducedMatrix[2], get_column_content_via_iterators(m.get_column(2))); + test_column_equality(reducedMatrix[3], get_column_content_via_iterators(m.get_column(3))); + test_column_equality(reducedMatrix[4], get_column_content_via_iterators(m.get_column(4))); + test_column_equality(reducedMatrix[5], get_column_content_via_iterators(m.get_column(5))); + test_column_equality(reducedMatrix[6], get_column_content_via_iterators(m.get_column(6))); + test_column_equality(reducedMatrix[7], get_column_content_via_iterators(m.get_column(10))); + test_column_equality(reducedMatrix[8], get_column_content_via_iterators(m.get_column(11))); + test_column_equality(reducedMatrix[9], get_column_content_via_iterators(m.get_column(12))); + test_column_equality(reducedMatrix[10], get_column_content_via_iterators(m.get_column(13))); + test_column_equality(reducedMatrix[11], get_column_content_via_iterators(m.get_column(14))); + test_column_equality(reducedMatrix[12], get_column_content_via_iterators(m.get_column(15))); + test_column_equality(reducedMatrix[13], get_column_content_via_iterators(m.get_column(16))); + test_column_equality(reducedMatrix[14], get_column_content_via_iterators(m.get_column(17))); + test_column_equality(reducedMatrix[15], get_column_content_via_iterators(m.get_column(30))); + test_column_equality(reducedMatrix[16], get_column_content_via_iterators(m.get_column(31))); + } else { + test_content_equality(reducedMatrix, m); + } + + std::set, BarComp> bars1; + std::set, BarComp> bars2; + std::set, BarComp> bars3; + // bars are not ordered the same for all matrices + for (auto it = barcode.begin(); it != barcode.end(); ++it) { + //three access possibilities + bars1.emplace(it->dim, it->birth, it->death); + bars2.emplace(std::get<2>(*it), std::get<0>(*it), std::get<1>(*it)); + auto [ x, y, z ] = *it; + bars3.emplace(z, x, y); + } + auto it = bars1.begin(); + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 0); + BOOST_CHECK_EQUAL(std::get<2>(*it), -1); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 1); + BOOST_CHECK_EQUAL(std::get<2>(*it), 7); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 2); + BOOST_CHECK_EQUAL(std::get<2>(*it), 9); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 3); + BOOST_CHECK_EQUAL(std::get<2>(*it), 8); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 4); + BOOST_CHECK_EQUAL(std::get<2>(*it), 10); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 5); + BOOST_CHECK_EQUAL(std::get<2>(*it), 14); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 0); + BOOST_CHECK_EQUAL(std::get<1>(*it), 6); + BOOST_CHECK_EQUAL(std::get<2>(*it), 12); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 1); + BOOST_CHECK_EQUAL(std::get<1>(*it), 11); + BOOST_CHECK_EQUAL(std::get<2>(*it), 15); + ++it; + BOOST_CHECK_EQUAL(std::get<0>(*it), 1); + BOOST_CHECK_EQUAL(std::get<1>(*it), 13); + BOOST_CHECK_EQUAL(std::get<2>(*it), 16); + ++it; + BOOST_CHECK(it == bars1.end()); + + BOOST_CHECK(bars1 == bars2); + BOOST_CHECK(bars1 == bars3); +} + +template +void test_shifted_barcode2() { using C = typename Matrix::Column; struct BarComp { bool operator()(const std::tuple& c1, const std::tuple& c2) const { - if (std::get<0>(c1) == std::get<0>(c2)) return std::get<1>(c1) < std::get<1>(c2); - return std::get<0>(c1) < std::get<0>(c2); + if (std::get<0>(c1) != std::get<0>(c2)) return std::get<0>(c1) < std::get<0>(c2); + if (std::get<1>(c1) != std::get<1>(c2)) return std::get<1>(c1) < std::get<1>(c2); + return std::get<2>(c1) < std::get<2>(c2); } }; @@ -1553,6 +1762,12 @@ void test_shifted_barcode() { BOOST_CHECK(bars1 == bars3); } +template +void test_shifted_barcode() { + test_shifted_barcode1(); + test_shifted_barcode2(); +} + template void test_base_swaps() { auto columns = build_simple_boundary_matrix(); From e78aecfad61cf8884accde09106fcfb3977b0fd1 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Tue, 19 Nov 2024 10:36:03 +0100 Subject: [PATCH 4/7] Rollback pip build linux with python 3.9 --- .github/workflows/pip-build-linux.yml | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pip-build-linux.yml b/.github/workflows/pip-build-linux.yml index 7026bbdcb0..f7c88d34de 100644 --- a/.github/workflows/pip-build-linux.yml +++ b/.github/workflows/pip-build-linux.yml @@ -17,28 +17,28 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - name: Build wheel for Python 3.13 + - name: Build wheel for Python 3.9 run: | - mkdir build_313 - cd build_313 - cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON313/bin/python .. + mkdir build_39 + cd build_39 + cmake -DCMAKE_BUILD_TYPE=Release -DPython_EXECUTABLE=$PYTHON39/bin/python .. cd src/python - $PYTHON313/bin/python -m build -n -w + $PYTHON39/bin/python -m build -n -w auditwheel repair dist/*.whl # NumPy 2.X is installed and guarantees ABI compatibility, test it with the minimal numpy version for python version - - name: Install and test wheel for Python 3.13 + - name: Install and test wheel for Python 3.9 run: | - $PYTHON313/bin/python -m pip install --user pytest build_313/src/python/dist/*.whl - $PYTHON313/bin/python -m pip install numpy~=2.1.2 - $PYTHON313/bin/python -c "import gudhi; print(gudhi.__version__)" - $PYTHON313/bin/python -m pytest -v src/python/test/test_alpha_complex.py - $PYTHON313/bin/python -m pytest -v src/python/test/test_delaunay_complex.py - $PYTHON313/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py - $PYTHON313/bin/python -m pytest -v src/python/test/test_cubical_complex.py - $PYTHON313/bin/python -m pytest -v src/python/test/test_rips_complex.py + $PYTHON39/bin/python -m pip install --user pytest build_39/src/python/dist/*.whl + $PYTHON39/bin/python -m pip install numpy~=1.19.3 + $PYTHON39/bin/python -c "import gudhi; print(gudhi.__version__)" + $PYTHON39/bin/python -m pytest -v src/python/test/test_alpha_complex.py + $PYTHON39/bin/python -m pytest -v src/python/test/test_delaunay_complex.py + $PYTHON39/bin/python -m pytest -v src/python/test/test_bottleneck_distance.py + $PYTHON39/bin/python -m pytest -v src/python/test/test_cubical_complex.py + $PYTHON39/bin/python -m pytest -v src/python/test/test_rips_complex.py - name: Upload linux python wheel # Should use actions/upload-artifact@v4, but requires node20, not available for quay.io/pypa/manylinux2014_x86_64 uses: actions/upload-artifact@v3 with: name: linux python wheel - path: build_313/src/python/wheelhouse/*.whl + path: build_39/src/python/wheelhouse/*.whl From 82017d15cc536dfbffa161d980ad99e8439af03c Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau Date: Tue, 19 Nov 2024 14:20:29 +0100 Subject: [PATCH 5/7] Try to downgrade macos version to check if it is not clang that is looping endlesslyon compilation --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4896615006..f98183d090 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -4,7 +4,7 @@ jobs: timeoutInMinutes: 0 cancelTimeoutInMinutes: 60 pool: - vmImage: macOS-latest + vmImage: macOS-13 variables: pythonVersion: "3.9" cmakeBuildType: Release From 2218978cfcfc70ea30c421143e4407557a5f6afc Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Wed, 20 Nov 2024 09:56:21 +0100 Subject: [PATCH 6/7] [skip ci] play with badges --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 40b64ae0b6..00959fd626 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ -[![OSx and Win on Azure](https://dev.azure.com/GUDHI/gudhi-devel/_apis/build/status/GUDHI.gudhi-devel?branchName=master)](https://dev.azure.com/GUDHI/gudhi-devel/_build/latest?definitionId=1&branchName=master) +CI: [![OSx and Win on Azure](https://dev.azure.com/GUDHI/gudhi-devel/_apis/build/status/GUDHI.gudhi-devel?branchName=master)](https://dev.azure.com/GUDHI/gudhi-devel/_build/latest?definitionId=1&branchName=master) [![Linux on CircleCI](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master.svg?style=svg)](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master) +| Conda: [![Anaconda Cloud](https://anaconda.org/conda-forge/gudhi/badges/version.svg)](https://anaconda.org/conda-forge/gudhi) -[![Anaconda downloads](https://anaconda.org/conda-forge/gudhi/badges/downloads.svg)](https://anaconda.org/conda-forge/gudhi) +![Conda Downloads](https://img.shields.io/conda/d/conda-forge/gudhi) +| PyPI: +![PyPI - Version](https://img.shields.io/pypi/v/gudhi) +![PyPI - Downloads](https://img.shields.io/pypi/dm/gudhi) ![GUDHI](src/common/doc/Gudhi_banner.png "Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding") From e8b1eff1b3de72b68180c6816e42ba702ca6cf25 Mon Sep 17 00:00:00 2001 From: Vincent Rouvreau <10407034+VincentRouvreau@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:02:22 +0100 Subject: [PATCH 7/7] [skip ci] still badges --- README.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 00959fd626..62468d4294 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,5 @@ - -CI: [![OSx and Win on Azure](https://dev.azure.com/GUDHI/gudhi-devel/_apis/build/status/GUDHI.gudhi-devel?branchName=master)](https://dev.azure.com/GUDHI/gudhi-devel/_build/latest?definitionId=1&branchName=master) -[![Linux on CircleCI](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master.svg?style=svg)](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master) -| Conda: -[![Anaconda Cloud](https://anaconda.org/conda-forge/gudhi/badges/version.svg)](https://anaconda.org/conda-forge/gudhi) -![Conda Downloads](https://img.shields.io/conda/d/conda-forge/gudhi) -| PyPI: -![PyPI - Version](https://img.shields.io/pypi/v/gudhi) -![PyPI - Downloads](https://img.shields.io/pypi/dm/gudhi) - +| [![OSx and Win on Azure](https://dev.azure.com/GUDHI/gudhi-devel/_apis/build/status/GUDHI.gudhi-devel?branchName=master)](https://dev.azure.com/GUDHI/gudhi-devel/_build/latest?definitionId=1&branchName=master) [![Linux on CircleCI](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master.svg?style=svg)](https://circleci.com/gh/GUDHI/gudhi-devel/tree/master) | [![Anaconda Cloud](https://anaconda.org/conda-forge/gudhi/badges/version.svg)](https://anaconda.org/conda-forge/gudhi) ![Conda Downloads](https://img.shields.io/conda/d/conda-forge/gudhi) | ![PyPI - Version](https://img.shields.io/pypi/v/gudhi) ![PyPI - Downloads](https://img.shields.io/pypi/dm/gudhi) | +| --- | --- | --- | ![GUDHI](src/common/doc/Gudhi_banner.png "Topological Data Analysis (TDA) and Higher Dimensional Geometry Understanding")