Giter Site home page Giter Site logo

giotto-ai / giotto-ph Goto Github PK

View Code? Open in Web Editor NEW
41.0 41.0 10.0 35.9 MB

High performance implementation of Vietoris-Rips persistence.

Home Page: https://giotto-ai.github.io/giotto-ph/

License: Other

CMake 2.25% Python 32.68% C++ 65.07%
computational-topology machine-learning topological-data-analysis topology

giotto-ph's People

Contributors

giotto-learn avatar monkeybreaker avatar rballeba avatar ulupo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

giotto-ph's Issues

"undefined symbol __atomic_compare_exchange" when compiled with clang. requires to be linked against "atomic"

Installing giotto-ph from source and compiling with clang (version 16.0.6) yields "ImportError: /stash/gtda/giotto-ph/gph/modules/gph_ripser_coeff.cpython-311-x86_64-linux-gnu.so: undefined symbol: __atomic_compare_exchange" when trying to import gph_ripser.

The solution for clang is to add the atomic library in the linked libraries, e.g. like this: https://gist.github.com/nwaniek/eeff24b4048e34948104059550df6520

Possibly faster get_simplex_vertices for 1-d simplices?

Currently, get_simplex_vertices is implemented by iterating a call to get_max_vertex, and this in turn is implemented via a binary search. But in the case of 1-dimensional simplices, which correspond to entries in the compressed distance matrix, a closed-form solution exists. For upper triangular distance matrices in compressed format, it is explained e.g. in https://stackoverflow.com/a/36867493.

An idea could be to benchmark this and see if it gives any non-trivial speedup when the maximum homology dimension to compute is 1.

Allow computation of barcodes for graphs (no 2-simplices)

It would be extremely useful for many important applications to have the flexibility to compute barcodes up to homology dimension 1 only for a filtration that has no 2-simplices at all. This would amount to artificially not enumerate 2-simplices, so should in principle be possible to do.

Garbage collection step in python interface is too runtime-costly

It seems to me that the price to pay for freeing up some memory in

del dm
gc.collect()
is too high in terms of runtime when the input is small. This will cause ripser_parallel to be too slow in applications with repeated calls on small inputs.

This step was introduced to address the fact that, for large input distance matrices, both a 2D square version and a compressed version will be created inside ripser_parallel. Ultimately, I think a better way to address this issue will be to compute compressed distance matrices whenever possible, and to allow the user to pass compressed distance matrices.

Allow users to import ripser_parallel more intuitively

At the moment, Python users have to do from gph.python import ripser_parallel. It is maybe a bit weird to have to import a subpackage called "python" in a python program. Should we change this, moving forward, to one of:

  1. from gph import ripser_parallel (super quick)?
  2. from gph.ripser import ripser_parallel (similar to ripser.py, more future proof when giotto-ph contains other filtrations)?

Building from source failed

Hi,

I have been trying to build giotto-ph from source following the developer guidelines at https://giotto-ai.github.io/giotto-ph/build/html/installation.html#developer-installation. My system is MacOS 13.4 with Intel i9 processor, and I am running this in a new Conda environment, I get the following error when I run python -m pip install -e ".[dev]". Any clues as to what is going on? Thanks.

Downloading ipykernel-6.25.0-py3-none-any.whl (153 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 153.9/153.9 kB 6.1 MB/s eta 0:00:00
Downloading prometheus_client-0.17.1-py3-none-any.whl (60 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 60.6/60.6 kB 2.1 MB/s eta 0:00:00
Downloading websocket_client-1.6.1-py3-none-any.whl (56 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.9/56.9 kB 2.0 MB/s eta 0:00:00
Downloading comm-0.1.4-py3-none-any.whl (6.6 kB)
Downloading ipython-8.14.0-py3-none-any.whl (798 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 798.7/798.7 kB 18.9 MB/s eta 0:00:00
Downloading nest_asyncio-1.5.7-py3-none-any.whl (5.3 kB)
Downloading jedi-0.19.0-py2.py3-none-any.whl (1.6 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 28.0 MB/s eta 0:00:00
Downloading jsonpointer-2.4-py2.py3-none-any.whl (7.8 kB)
Downloading prompt_toolkit-3.0.39-py3-none-any.whl (385 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 385.2/385.2 kB 11.7 MB/s eta 0:00:00
Downloading uri_template-1.3.0-py3-none-any.whl (11 kB)
Building wheels for collected packages: jupyter_contrib_nbextensions, jupyter_contrib_core
  Building wheel for jupyter_contrib_nbextensions (setup.py) ... done
  Created wheel for jupyter_contrib_nbextensions: filename=jupyter_contrib_nbextensions-0.7.0-py2.py3-none-any.whl size=23428780 sha256=50bf0f06f71a5c34c1c15e9a5205f6c57e1dd78140c49203ef58db2351a18a55
  Stored in directory: /Users/longyuxi/Library/Caches/pip/wheels/cd/25/fe/cb6f3e82f5b1921b0157ac9e32adb2e54806ec1befc446be21
  Building wheel for jupyter_contrib_core (setup.py) ... done
  Created wheel for jupyter_contrib_core: filename=jupyter_contrib_core-0.4.2-py2.py3-none-any.whl size=17482 sha256=854fe4234b006d28702b177286248bdaf08eddbc5e39294171e27f9d2622e522
  Stored in directory: /Users/longyuxi/Library/Caches/pip/wheels/37/c3/18/be7a983c1120f15dc0c2d1cb9c33749871a93b034185e00ced
Successfully built jupyter_contrib_nbextensions jupyter_contrib_core
Installing collected packages: webencodings, wcwidth, sortedcontainers, snowballstemmer, py-cpuinfo, pure-eval, ptyprocess, pickleshare, jupyter_highlight_selected_word, json5, ipython_genutils, fastjsonschema, executing, backcall, appnope, websocket-client, webcolors, urllib3, uri-template, traitlets, tornado, tinycss2, threadpoolctl, sphinxcontrib-serializinghtml, sphinxcontrib-qthelp, sphinxcontrib-jsmath, sphinxcontrib-htmlhelp, sphinxcontrib-devhelp, sphinxcontrib-applehelp, soupsieve, sniffio, six, send2trash, rpds-py, rfc3986-validator, pyzmq, pyyaml, python-json-logger, pygments, pyflakes, pycparser, pycodestyle, psutil, prompt-toolkit, prometheus-client, pluggy, platformdirs, pexpect, parso, pandocfilters, packaging, overrides, numpy, nest-asyncio, mistune, mccabe, markupsafe, lxml, jupyterlab-pygments, jsonpointer, joblib, iniconfig, imagesize, idna, fqdn, docutils, defusedxml, decorator, debugpy, coverage, charset-normalizer, certifi, babel, attrs, async-lru, alabaster, terminado, scipy, rfc3339-validator, requests, referencing, python-dateutil, pytest, matplotlib-inline, jupyter_core, jinja2, jedi, hypothesis, flake8, comm, cffi, bleach, beautifulsoup4, asttokens, anyio, stack-data, sphinx, scikit-learn, pytest-nunit, pytest-cov, pytest-benchmark, jupyter-server-terminals, jupyter-client, jsonschema-specifications, arrow, argon2-cffi-bindings, sphinxcontrib-jquery, sphinx-issues, pytest-azurepipelines, numpydoc, jsonschema, isoduration, ipython, giotto-ph, argon2-cffi, sphinx_rtd_theme, nbformat, ipykernel, nbclient, jupyter-events, nbconvert, jupyter-server, notebook-shim, jupyterlab-server, jupyter-lsp, jupyterlab, notebook, jupyter_contrib_core, jupyter_nbextensions_configurator, jupyter_contrib_nbextensions
  Running setup.py develop for giotto-ph
    error: subprocess-exited-with-error

    × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [363 lines of output]
        /Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/dist.py:745: SetuptoolsDeprecationWarning: Invalid dash-separated options
        !!

                ********************************************************************************
                Usage of dash-separated 'description-file' will not be supported in future
                versions. Please use the underscore name 'description_file' instead.

                By 2023-Sep-26, you need to update your project and remove deprecated calls
                or your builds will no longer be supported.

                See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
                ********************************************************************************

        !!
          opt = self.warn_dash_deprecation(opt, section)
        running develop
        /Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
        !!

                ********************************************************************************
                Please avoid running ``setup.py`` and ``easy_install``.
                Instead, use pypa/build, pypa/installer or other
                standards-based tools.

                See https://github.com/pypa/setuptools/issues/917 for details.
                ********************************************************************************

        !!
          easy_install.initialize_options(self)
        /Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
        !!

                ********************************************************************************
                Please avoid running ``setup.py`` directly.
                Instead, use pypa/build, pypa/installer or other
                standards-based tools.

                See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
                ********************************************************************************

        !!
          self.initialize_options()
        running egg_info
        creating giotto_ph.egg-info
        writing giotto_ph.egg-info/PKG-INFO
        writing dependency_links to giotto_ph.egg-info/dependency_links.txt
        writing requirements to giotto_ph.egg-info/requires.txt
        writing top-level names to giotto_ph.egg-info/top_level.txt
        writing manifest file 'giotto_ph.egg-info/SOURCES.txt'
        reading manifest file 'giotto_ph.egg-info/SOURCES.txt'
        adding license file 'LICENSE'
        writing manifest file 'giotto_ph.egg-info/SOURCES.txt'
        running build_ext
        Submodule 'giotto_ph/ext/junction' (https://github.com/preshing/junction) registered for path 'gph/ext/junction'
        Submodule 'src/pybind11' (https://github.com/pybind/pybind11) registered for path 'gph/ext/pybind11'
        Submodule 'giotto_ph/ext/turf' (https://github.com/preshing/turf) registered for path 'gph/ext/turf'
        Cloning into '/Users/longyuxi/Downloads/giotto-ph/gph/ext/junction'...
        Cloning into '/Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11'...
        Cloning into '/Users/longyuxi/Downloads/giotto-ph/gph/ext/turf'...
        Submodule path 'gph/ext/junction': checked out '5ad3be7ce1d3f16b9f7ed6065bbfeacd2d629a08'
        Submodule path 'gph/ext/pybind11': checked out '48534089f7f1b0229bc7ae2e4d0f21dc9ad169b5'
        Submodule path 'gph/ext/turf': checked out '9ae0d4b984fa95ed5f823274b39c87ee742f6650'
        -- The CXX compiler identification is AppleClang 14.0.3.14030022
        -- Detecting CXX compiler ABI info
        -- Detecting CXX compiler ABI info - done
        -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
        -- Detecting CXX compile features
        -- Detecting CXX compile features - done
        CMake Deprecation Warning at gph/ext/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
          Compatibility with CMake < 3.5 will be removed from a future version of
          CMake.

          Update the VERSION argument <min> value or use a ...<max> suffix to tell
          CMake that the project does not need compatibility with older versions.


        -- pybind11 v2.6.2 dev1
        CMake Warning (dev) at gph/ext/pybind11/tools/FindPythonLibsNew.cmake:96 (find_package):
          Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
          are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
          the cmake_policy command to set the policy and suppress this warning.

        Call Stack (most recent call first):
          gph/ext/pybind11/tools/pybind11Tools.cmake:38 (find_package)
          gph/ext/pybind11/tools/pybind11Common.cmake:201 (include)
          gph/ext/pybind11/CMakeLists.txt:169 (include)
        This warning is for project developers.  Use -Wno-dev to suppress it.

        -- Found PythonInterp: /Users/longyuxi/mambaforge/envs/gph-dev/bin/python (found version "3.11.4")
        -- Found PythonLibs: /Users/longyuxi/mambaforge/envs/gph-dev/lib/libpython3.11.dylib
        -- Performing Test HAS_FLTO
        -- Performing Test HAS_FLTO - Success
        -- Performing Test HAS_FLTO_THIN
        -- Performing Test HAS_FLTO_THIN - Success
        CMake Deprecation Warning at gph/ext/junction/CMakeLists.txt:1 (cmake_minimum_required):
          Compatibility with CMake < 3.5 will be removed from a future version of
          CMake.

          Update the VERSION argument <min> value or use a ...<max> suffix to tell
          CMake that the project does not need compatibility with older versions.


        CMake Deprecation Warning at gph/ext/turf/CMakeLists.txt:1 (cmake_minimum_required):
          Compatibility with CMake < 3.5 will be removed from a future version of
          CMake.

          Update the VERSION argument <min> value or use a ...<max> suffix to tell
          CMake that the project does not need compatibility with older versions.


        Checking for <stdint.h> -- yes
        Checking for noexcept keyword -- no
        Checking for constexpr keyword -- no
        Checking for override keyword -- yes
        Checking for long long -- yes
        Checking for static_assert -- no
        Checking for std::move -- yes
        -- Configuring done (7.6s)
        -- Generating done (0.1s)
        -- Build files have been written to: /Users/longyuxi/Downloads/giotto-ph/build/temp.macosx-10.9-x86_64-cpython-311
        [  6%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/Core.cpp.o
        [  6%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/ConcurrentMap_Grampa.cpp.o
        [  9%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/Heap.cpp.o
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/turf/turf/Heap.cpp:32:6: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch]
        void operator delete(void* ptr) TURF_NOEXCEPT {
             ^
        /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/new:193:36: note: previous declaration is here
        _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
                                           ^
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/turf/turf/Heap.cpp:36:6: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch]
        void operator delete[](void* ptr) TURF_NOEXCEPT {
             ^
        /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/new:201:36: note: previous declaration is here
        _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p) _NOEXCEPT;
                                           ^
        2 warnings generated.
        [ 12%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/UTCTime.cpp.o
        [ 16%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/extra/Options.cpp.o
        [ 19%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/ConcurrentMap_Leapfrog.cpp.o
        [ 22%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/extra/Random.cpp.o
        [ 25%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/ConcurrentMap_Linear.cpp.o
        [ 29%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/extra/TimeWaster.cpp.o
        [ 32%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Affinity_FreeBSD.cpp.o
        [ 35%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/QSBR.cpp.o
        [ 38%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Affinity_Linux.cpp.o
        [ 41%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Affinity_Win32.cpp.o
        [ 45%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Heap_DL.cpp.o
        [ 48%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Trace_Counters.cpp.o
        [ 51%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/details/Grampa.cpp.o
        [ 54%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Trace_MemLog.cpp.o
        [ 58%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/details/Leapfrog.cpp.o
        [ 61%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Trace_Null.cpp.o
        [ 64%] Linking CXX static library libturf.a
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Core.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_FreeBSD.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Linux.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Win32.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Heap_DL.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Core.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_FreeBSD.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Linux.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Win32.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Heap_DL.cpp.o) has no symbols
        [ 67%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/details/Linear.cpp.o
        [ 67%] Built target turf
        [ 70%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/extra/MemHook_NBDS.cpp.o
        [ 74%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/extra/MemHook_TBB.cpp.o
        [ 77%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/striped/ConditionBank.cpp.o
        [ 80%] Building CXX object CMakeFiles/gph_collapser.dir/gph/bindings/collapser_bindings.cpp.o
        clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
        [ 83%] Linking CXX static library libjunction.a
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Grampa.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Leapfrog.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Linear.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Grampa.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Leapfrog.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Linear.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_NBDS.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_TBB.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Grampa.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Leapfrog.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Linear.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Grampa.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Leapfrog.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Linear.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_NBDS.cpp.o) has no symbols
        /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_TBB.cpp.o) has no symbols
        [ 83%] Built target junction
        [ 87%] Building CXX object CMakeFiles/gph_ripser.dir/gph/bindings/ripser_bindings.cpp.o
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                        "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                           ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:448:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                        handle(frame->f_code->co_name).cast<std::string>() + "\n";
                                    ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:449:26: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    frame = frame->f_back;
                                 ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2291:49: error: no member named 'frame' in '_ts'
            PyFrameObject *frame = PyThreadState_Get()->frame;
                                   ~~~~~~~~~~~~~~~~~~~  ^
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2292:41: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
            if (frame && (std::string) str(frame->f_code->co_name) == name &&
                                                ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2293:14: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame->f_code->co_argcount > 0) {
                     ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:18: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                         ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:52: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                                                           ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                        "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                           ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:448:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                        handle(frame->f_code->co_name).cast<std::string>() + "\n";
                                    ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:449:26: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    frame = frame->f_back;
                                 ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2291:49: error: no member named 'frame' in '_ts'
            PyFrameObject *frame = PyThreadState_Get()->frame;
                                   ~~~~~~~~~~~~~~~~~~~  ^
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2292:41: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
            if (frame && (std::string) str(frame->f_code->co_name) == name &&
                                                ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2293:14: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame->f_code->co_argcount > 0) {
                     ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:18: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                         ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
        In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
        /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:52: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                                                           ^
        /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
        typedef struct _frame PyFrameObject;
                       ^
        8 errors generated.
        make[2]: *** [CMakeFiles/gph_collapser.dir/gph/bindings/collapser_bindings.cpp.o] Error 1
        make[1]: *** [CMakeFiles/gph_collapser.dir/all] Error 2
        make[1]: *** Waiting for unfinished jobs....
        8 errors generated.
        make[2]: *** [CMakeFiles/gph_ripser.dir/gph/bindings/ripser_bindings.cpp.o] Error 1
        make[1]: *** [CMakeFiles/gph_ripser.dir/all] Error 2
        make: *** [all] Error 2
        Traceback (most recent call last):
          File "<string>", line 2, in <module>
          File "<pip-setuptools-caller>", line 34, in <module>
          File "/Users/longyuxi/Downloads/giotto-ph/setup.py", line 147, in <module>
            setup(name=DISTNAME,
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
            return distutils.core.setup(**attrs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
            return run_commands(dist)
                   ^^^^^^^^^^^^^^^^^^
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
            dist.run_commands()
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
            self.run_command(cmd)
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/command/develop.py", line 34, in run
            self.install_for_development()
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/command/develop.py", line 111, in install_for_development
            self.run_command('build_ext')
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
            self.distribution.run_command(command)
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
            super().run_command(command)
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
            cmd_obj.run()
          File "/Users/longyuxi/Downloads/giotto-ph/setup.py", line 104, in run
            self.build_extension(ext)
          File "/Users/longyuxi/Downloads/giotto-ph/setup.py", line 143, in build_extension
            subprocess.check_call(["cmake", "--build", "."] + build_args,
          File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/subprocess.py", line 413, in check_call
            raise CalledProcessError(retcode, cmd)
        subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [363 lines of output]
    /Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/dist.py:745: SetuptoolsDeprecationWarning: Invalid dash-separated options
    !!

            ********************************************************************************
            Usage of dash-separated 'description-file' will not be supported in future
            versions. Please use the underscore name 'description_file' instead.

            By 2023-Sep-26, you need to update your project and remove deprecated calls
            or your builds will no longer be supported.

            See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
            ********************************************************************************

    !!
      opt = self.warn_dash_deprecation(opt, section)
    running develop
    /Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/command/develop.py:40: EasyInstallDeprecationWarning: easy_install command is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` and ``easy_install``.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://github.com/pypa/setuptools/issues/917 for details.
            ********************************************************************************

    !!
      easy_install.initialize_options(self)
    /Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/cmd.py:66: SetuptoolsDeprecationWarning: setup.py install is deprecated.
    !!

            ********************************************************************************
            Please avoid running ``setup.py`` directly.
            Instead, use pypa/build, pypa/installer or other
            standards-based tools.

            See https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html for details.
            ********************************************************************************

    !!
      self.initialize_options()
    running egg_info
    creating giotto_ph.egg-info
    writing giotto_ph.egg-info/PKG-INFO
    writing dependency_links to giotto_ph.egg-info/dependency_links.txt
    writing requirements to giotto_ph.egg-info/requires.txt
    writing top-level names to giotto_ph.egg-info/top_level.txt
    writing manifest file 'giotto_ph.egg-info/SOURCES.txt'
    reading manifest file 'giotto_ph.egg-info/SOURCES.txt'
    adding license file 'LICENSE'
    writing manifest file 'giotto_ph.egg-info/SOURCES.txt'
    running build_ext
    Submodule 'giotto_ph/ext/junction' (https://github.com/preshing/junction) registered for path 'gph/ext/junction'
    Submodule 'src/pybind11' (https://github.com/pybind/pybind11) registered for path 'gph/ext/pybind11'
    Submodule 'giotto_ph/ext/turf' (https://github.com/preshing/turf) registered for path 'gph/ext/turf'
    Cloning into '/Users/longyuxi/Downloads/giotto-ph/gph/ext/junction'...
    Cloning into '/Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11'...
    Cloning into '/Users/longyuxi/Downloads/giotto-ph/gph/ext/turf'...
    Submodule path 'gph/ext/junction': checked out '5ad3be7ce1d3f16b9f7ed6065bbfeacd2d629a08'
    Submodule path 'gph/ext/pybind11': checked out '48534089f7f1b0229bc7ae2e4d0f21dc9ad169b5'
    Submodule path 'gph/ext/turf': checked out '9ae0d4b984fa95ed5f823274b39c87ee742f6650'
    -- The CXX compiler identification is AppleClang 14.0.3.14030022
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
    -- Detecting CXX compile features
    -- Detecting CXX compile features - done
    CMake Deprecation Warning at gph/ext/pybind11/CMakeLists.txt:8 (cmake_minimum_required):
      Compatibility with CMake < 3.5 will be removed from a future version of
      CMake.

      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.


    -- pybind11 v2.6.2 dev1
    CMake Warning (dev) at gph/ext/pybind11/tools/FindPythonLibsNew.cmake:96 (find_package):
      Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
      are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
      the cmake_policy command to set the policy and suppress this warning.

    Call Stack (most recent call first):
      gph/ext/pybind11/tools/pybind11Tools.cmake:38 (find_package)
      gph/ext/pybind11/tools/pybind11Common.cmake:201 (include)
      gph/ext/pybind11/CMakeLists.txt:169 (include)
    This warning is for project developers.  Use -Wno-dev to suppress it.

    -- Found PythonInterp: /Users/longyuxi/mambaforge/envs/gph-dev/bin/python (found version "3.11.4")
    -- Found PythonLibs: /Users/longyuxi/mambaforge/envs/gph-dev/lib/libpython3.11.dylib
    -- Performing Test HAS_FLTO
    -- Performing Test HAS_FLTO - Success
    -- Performing Test HAS_FLTO_THIN
    -- Performing Test HAS_FLTO_THIN - Success
    CMake Deprecation Warning at gph/ext/junction/CMakeLists.txt:1 (cmake_minimum_required):
      Compatibility with CMake < 3.5 will be removed from a future version of
      CMake.

      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.


    CMake Deprecation Warning at gph/ext/turf/CMakeLists.txt:1 (cmake_minimum_required):
      Compatibility with CMake < 3.5 will be removed from a future version of
      CMake.

      Update the VERSION argument <min> value or use a ...<max> suffix to tell
      CMake that the project does not need compatibility with older versions.


    Checking for <stdint.h> -- yes
    Checking for noexcept keyword -- no
    Checking for constexpr keyword -- no
    Checking for override keyword -- yes
    Checking for long long -- yes
    Checking for static_assert -- no
    Checking for std::move -- yes
    -- Configuring done (7.6s)
    -- Generating done (0.1s)
    -- Build files have been written to: /Users/longyuxi/Downloads/giotto-ph/build/temp.macosx-10.9-x86_64-cpython-311
    [  6%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/Core.cpp.o
    [  6%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/ConcurrentMap_Grampa.cpp.o
    [  9%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/Heap.cpp.o
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/turf/turf/Heap.cpp:32:6: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch]
    void operator delete(void* ptr) TURF_NOEXCEPT {
         ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/new:193:36: note: previous declaration is here
    _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete(void* __p) _NOEXCEPT;
                                       ^
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/turf/turf/Heap.cpp:36:6: warning: function previously declared with an explicit exception specification redeclared with an implicit exception specification [-Wimplicit-exception-spec-mismatch]
    void operator delete[](void* ptr) TURF_NOEXCEPT {
         ^
    /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/new:201:36: note: previous declaration is here
    _LIBCPP_OVERRIDABLE_FUNC_VIS void  operator delete[](void* __p) _NOEXCEPT;
                                       ^
    2 warnings generated.
    [ 12%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/UTCTime.cpp.o
    [ 16%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/extra/Options.cpp.o
    [ 19%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/ConcurrentMap_Leapfrog.cpp.o
    [ 22%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/extra/Random.cpp.o
    [ 25%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/ConcurrentMap_Linear.cpp.o
    [ 29%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/extra/TimeWaster.cpp.o
    [ 32%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Affinity_FreeBSD.cpp.o
    [ 35%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/QSBR.cpp.o
    [ 38%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Affinity_Linux.cpp.o
    [ 41%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Affinity_Win32.cpp.o
    [ 45%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Heap_DL.cpp.o
    [ 48%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Trace_Counters.cpp.o
    [ 51%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/details/Grampa.cpp.o
    [ 54%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Trace_MemLog.cpp.o
    [ 58%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/details/Leapfrog.cpp.o
    [ 61%] Building CXX object gph/ext/junction/turf/CMakeFiles/turf.dir/turf/impl/Trace_Null.cpp.o
    [ 64%] Linking CXX static library libturf.a
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Core.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_FreeBSD.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Linux.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Win32.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Heap_DL.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Core.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_FreeBSD.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Linux.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Affinity_Win32.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libturf.a(Heap_DL.cpp.o) has no symbols
    [ 67%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/details/Linear.cpp.o
    [ 67%] Built target turf
    [ 70%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/extra/MemHook_NBDS.cpp.o
    [ 74%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/extra/MemHook_TBB.cpp.o
    [ 77%] Building CXX object gph/ext/junction/CMakeFiles/junction.dir/junction/striped/ConditionBank.cpp.o
    [ 80%] Building CXX object CMakeFiles/gph_collapser.dir/gph/bindings/collapser_bindings.cpp.o
    clang: warning: argument unused during compilation: '-shared' [-Wunused-command-line-argument]
    [ 83%] Linking CXX static library libjunction.a
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Grampa.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Leapfrog.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Linear.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Grampa.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Leapfrog.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Linear.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_NBDS.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_TBB.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Grampa.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Leapfrog.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(ConcurrentMap_Linear.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Grampa.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Leapfrog.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(Linear.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_NBDS.cpp.o) has no symbols
    /Library/Developer/CommandLineTools/usr/bin/ranlib: file: libjunction.a(MemHook_TBB.cpp.o) has no symbols
    [ 83%] Built target junction
    [ 87%] Building CXX object CMakeFiles/gph_ripser.dir/gph/bindings/ripser_bindings.cpp.o
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                       ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:448:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    handle(frame->f_code->co_name).cast<std::string>() + "\n";
                                ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:449:26: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame = frame->f_back;
                             ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2291:49: error: no member named 'frame' in '_ts'
        PyFrameObject *frame = PyThreadState_Get()->frame;
                               ~~~~~~~~~~~~~~~~~~~  ^
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2292:41: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
        if (frame && (std::string) str(frame->f_code->co_name) == name &&
                                            ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2293:14: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
            frame->f_code->co_argcount > 0) {
                 ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:18: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                     ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/collapser_bindings.cpp:8:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:52: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                                                       ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:446:36: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    "  " + handle(frame->f_code->co_filename).cast<std::string>() +
                                       ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:448:29: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                    handle(frame->f_code->co_name).cast<std::string>() + "\n";
                                ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:45:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/attr.h:13:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/cast.h:449:26: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame = frame->f_back;
                             ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2291:49: error: no member named 'frame' in '_ts'
        PyFrameObject *frame = PyThreadState_Get()->frame;
                               ~~~~~~~~~~~~~~~~~~~  ^
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2292:41: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
        if (frame && (std::string) str(frame->f_code->co_name) == name &&
                                            ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2293:14: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
            frame->f_code->co_argcount > 0) {
                 ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:18: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                     ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/bindings/ripser_bindings.cpp:10:
    In file included from /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/numpy.h:12:
    /Users/longyuxi/Downloads/giotto-ph/gph/ext/pybind11/include/pybind11/pybind11.h:2296:52: error: member access into incomplete type 'PyFrameObject' (aka '_frame')
                frame->f_locals, PyTuple_GET_ITEM(frame->f_code->co_varnames, 0));
                                                       ^
    /Users/longyuxi/mambaforge/envs/gph-dev/include/python3.11/pytypedefs.h:22:16: note: forward declaration of '_frame'
    typedef struct _frame PyFrameObject;
                   ^
    8 errors generated.
    make[2]: *** [CMakeFiles/gph_collapser.dir/gph/bindings/collapser_bindings.cpp.o] Error 1
    make[1]: *** [CMakeFiles/gph_collapser.dir/all] Error 2
    make[1]: *** Waiting for unfinished jobs....
    8 errors generated.
    make[2]: *** [CMakeFiles/gph_ripser.dir/gph/bindings/ripser_bindings.cpp.o] Error 1
    make[1]: *** [CMakeFiles/gph_ripser.dir/all] Error 2
    make: *** [all] Error 2
    Traceback (most recent call last):
      File "<string>", line 2, in <module>
      File "<pip-setuptools-caller>", line 34, in <module>
      File "/Users/longyuxi/Downloads/giotto-ph/setup.py", line 147, in <module>
        setup(name=DISTNAME,
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
        return distutils.core.setup(**attrs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
        return run_commands(dist)
               ^^^^^^^^^^^^^^^^^^
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
        dist.run_commands()
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
        self.run_command(cmd)
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
        super().run_command(command)
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
        cmd_obj.run()
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/command/develop.py", line 34, in run
        self.install_for_development()
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/command/develop.py", line 111, in install_for_development
        self.run_command('build_ext')
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
        self.distribution.run_command(command)
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command
        super().run_command(command)
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
        cmd_obj.run()
      File "/Users/longyuxi/Downloads/giotto-ph/setup.py", line 104, in run
        self.build_extension(ext)
      File "/Users/longyuxi/Downloads/giotto-ph/setup.py", line 143, in build_extension
        subprocess.check_call(["cmake", "--build", "."] + build_args,
      File "/Users/longyuxi/mambaforge/envs/gph-dev/lib/python3.11/subprocess.py", line 413, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['cmake', '--build', '.', '--config', 'Release', '--', '-j2']' returned non-zero exit status 2.
    [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.

Consistency in index dtypes

Here:

np.asarray(row, dtype=np.int32, order="C"),
np.asarray(col, dtype=np.int32, order="C"),

we convert indices to 32-bit ints. In the C++ code, is every index a 64-bit integer? It seems to me that the case of sparse matrices is one in which indices can be very large, so 64-bit ints might make sense. For dense matrices, there is no way int32 is not enough!

Failed dev installation on MacOS

Brief description

The dev installation failed at the C++ compilation step.

Steps to reproduce

After cloning the repo and moving into the root folder of the repo, I launched

pip install -e .

The installation failed. I tried on both branches (main and c++_backend)

Expected behaviour

The dev installation should not fail

Logs

logs.txt

Possible solution

My suggestion is to build the wheels in the CI and publish then as artefacts. The following code can be added directly, after the testing phase (currently done with pytest) in the CI:

    - name: Build and install wheels
      run: |
        set -e
        python -m pip install wheel
        python setup.py bdist_wheel
        python -m pip install dist/*.whl
    - name: Upload artifacts
      uses: actions/upload-artifact@v2
      with:
        name: pip_wheel_${{ matrix.python-version }}
        path: dist

One can then simply download the wheels and install them directly with pip. This should avoid compilers problems.

Add comments in backend code, and wiki

I think it would be really helpful for fellow developers if the ripser.h backend code had comments to help understand it. It doesn't have to be comprehensive, but a little bit of guidance would help. A wiki could also be added explaining things in greater detail. (This was already discussed with the core dev team but I am writing it here for better task management.)

Always treat bars with infinite death as essential bars

During work on this PR #29, @MonkeyBreaker and I realized that the current core logic in the matrix reduction algorithm makes it so that we break the following promise to the user: that passing a dense matrix with a few np.inf will lead to exactly the same output as passing a sparse version where the np.inf entries are just missing entries. This was never noticed at the level of barcodes because a "finite" bar with death equal to infinity looks just the same as an infinite bar with the same birth. But flag generators don't lie: we now end up telling the user there are never any generators for essential classes if the matrix is dense, no matter what the matrix is or represents.

Because changing this requires potentially delicate changes to the reduction routine, we decided to discuss what to do about this separately, and open a separate PR if necessary after this one is merged.

Originally posted by @ulupo in #29 (comment)

OverflowError

Hi,

when trying to calculate persistent homology up to dimension 5 for a point cloud of size 2000 via

ripser_parallel(X, coeff=2, maxdim=5, n_threads=30,thresh=0.255)

I am getting the following error message

---------------------------------------------------------------------------
OverflowError                             Traceback (most recent call last)
Cell In[11], line 1
----> 1 ripser_parallel(X, coeff=2, maxdim=5, n_threads=30,thresh=0.255)
File ~/.local/lib/python3.10/site-packages/gph/python/ripser_interface.py:603, in ripser_parallel(X, maxdim, thresh, coeff, metric, metric_params, nearest_neighbors_params, weights, weight_params, collapse_edges, n_threads, return_generators)
    600         use_sparse_computer = False
    602 if use_sparse_computer:
--> 603     res = _compute_ph_vr_sparse(
    604         np.asarray(row, dtype=np.int64, order="C"),
    605         np.asarray(col, dtype=np.int64, order="C"),
    606         np.asarray(data, dtype=np.float32, order="C"),
    607         n_points,
    608         maxdim,
    609         thresh,
    610         coeff,
    611         n_threads,
    612         return_generators
    613         )
    614 else:
    615     # Only consider upper diagonal
    616     diagonal = np.diagonal(dm).astype(np.float32)
File ~/.local/lib/python3.10/site-packages/gph/python/ripser_interface.py:51, in _compute_ph_vr_sparse(I, J, V, N, maxHomDim, thresh, coeff, n_threads, return_generators)
     48 def _compute_ph_vr_sparse(I, J, V, N, maxHomDim, thresh=-1, coeff=2,
     49                           n_threads=1, return_generators=False):
     50     if coeff == 2:
---> 51         ret = gph_ripser.rips_dm_sparse(I, J, V, I.size, N, coeff,
     52                                         maxHomDim, thresh, n_threads,
     53                                         return_generators)
     54     else:
     55         ret = gph_ripser_coeff.rips_dm_sparse(I, J, V, I.size, N, coeff,
     56                                               maxHomDim, thresh, n_threads,
     57                                               return_generators)
OverflowError: simplex index 9239466805310005056 in filtration is larger than maximum index 36028797018963967

Is it possible to increase the maximum for the number of simplices?

Generators of persistence diagrams do not correspond to longest edge in hole

Hi,

If I am understanding it correctly, the generators of a persistence diagram returned by ripser_parallel should match up with each persistence, right? In other words, the distance between the two points that make up a generator should correspond to either the birth or the death filtration parameter of a homology class in the persistence, right? I have found the results of ripser_parallel to be inconsistent with this hypothesis:

import numpy as np
import gph

# Take any two protein atoms and any two ligand atoms and you will create a hole in the 1D homology that appears at the maximum distance between a protein atom and a ligand atom
# The one dimensional holes created by this metric all disappear only at r=infinity
def opposition_homology(protein_coords, ligand_coords, maxdim):
    # Append each coordinate with 1 for protein and 4 for ligand
    protein_coords = np.concatenate((protein_coords, np.ones((len(protein_coords), 1))), axis=1)
    ligand_coords = np.concatenate((ligand_coords, 4 * np.ones((len(ligand_coords), 1))), axis=1)

    def opposition_distance_metric(vec1, vec2):
        if np.abs(vec1[-1] - vec2[-1]) > 2:  # If the two atoms do not have the same affiliation
            return np.linalg.norm(vec1[:3] - vec2[:3])
        else:
            return np.Inf

    combined_coords = np.concatenate((protein_coords, ligand_coords), axis=0)

    if combined_coords.shape[0] == 0:
        return None

    if protein_coords is None or ligand_coords is None:
        return None

    output = gph.ripser_parallel(combined_coords, maxdim=maxdim, metric=opposition_distance_metric, thresh=50, n_threads=-1, return_generators=True)

    return output

protein_coords = 50 * np.random.rand(100, 3)
ligand_coords = 50 * np.random.rand(100, 3)

output = opposition_homology(protein_coords, ligand_coords, maxdim=1)

diagrams = output['dgms']
generators = output['gens']

specific_dim_diagrams = diagrams[1][:, 0]  # Just the birth times can encode all the information since death times are inf
specific_dim_generators = generators[3][0]

assert specific_dim_diagrams.shape[0] == specific_dim_generators.shape[0]  # It is expected that we have the same number of diagrams as generators, now let's check that the birth radius is the same as the length of the edge between the two atoms

combined_coords = np.concatenate((protein_coords, ligand_coords))


## This assertion will fail, because for some unknown reason the generator indices are not in order.
count = 0
for idx in range(specific_dim_diagrams.shape[0]):
    test_diagram = specific_dim_diagrams[idx]  # Just keeps track of the birth radius. e.g. 49.98954
    test_diagram_generator = specific_dim_generators[idx]  # Indices of the vertices of the edge with that length. e.g. [1038  416]
    try:
        assert np.abs(np.linalg.norm(combined_coords[test_diagram_generator[0]] - combined_coords[test_diagram_generator[1]]) - test_diagram) < 0.1
    except AssertionError:
        count += 1

print(f'Number of diagrams: {specific_dim_diagrams.shape[0]}')
print(f'Number of assertions that failed: {count}')

Output floating point types

It seems that we output barcodes with 64-bit floating-point type. I think that, as things stand, this could be a little misleading because we internally convert to 32-bit representations and hence lose precision. Is there a reason I am missing why outputting doubles is preferrable?

Create conda package

giotto-ph should probably be packaged for distribution via conda/conda-forge.

Return simplex pairings and essential simplices

The ability to retrieve the simplex pairings and essential simplices associated to each bar in the barcode is, in my opinion, the single most important feature to add to the next version (which I am provisionally calling v0.2.0 and have created a board for in "Projects"). Without this feature, giotto-ph cannot be used in deep learning applications for instance.

Creating this issue to gather opinions and track the development of this feature.

[DOC] Dimension 0 is computed sequentially

It is maybe clear for library developers that dimension 0 is computed sequentially, where all dimensions != 0 are computed in parallel.

This behavior is mentioned in our paper, but it is mentioned nowhere in the docstring of the library.
We should add a mention to this, because users could be mislead that all the Persistent Homology computation is done in parallel.

Improve docstrings

There are some leftover inaccuracies in the docs for ripser_parallel especially when we mention the relationship with Ripser/ripser and scikit-tda/ripser.py.

Unify LONG_DESCRIPTION in setup.py and use delvewheel to repair Windows wheels

I think the reason for

giotto-ph/setup.py

Lines 29 to 30 in 780f456

if platform.system() == "Windows":
LONG_DESCRIPTION = "giotto-ph at https://github.com/giotto-ai/giotto-ph"
(which is absent in pyflagser and giotto-tda) and for the fact that we don't include a Giotto logo here is that issues arise when building Windows wheels due to the different treatment of newline characters between Windows and Unix.

giotto-ai/pyflagser#80 fixed this in pyflagser by using a sed command we already used in giotto-tda and pyflagser Azure pipelines. I suggest we do the same here (and include a Giotto logo in the README).

Finally, also in giotto-ai/pyflagser#80 I introduced delvewheel to repair Windows wheels, and I suggest we can consider doing it here too.

maxdim=0

Hello,
I tried to run gph.ripser_parallel(np.array([[1.,2],[3,4],[5,0]]), maxdim=0) but it segfaults (while it works with maxdim=1).

Extend dense backend to cover case of non-zero diagonal weights

Using weighted Rips filtrations means a dense dm is computed but crucially it will typically have non-zero values along the diagonal. Yet, we will use the sparse C++ backend in this case.

This causes a substantial loss in performance compared to what could be achieved with a dense backend, yet I think it is conceptually easy to cover such cases with the dense backend. We just need to allow for the possibility to pass diagonal information as an additional piece of data, and use it in the 0-dimensional computation. The higher-dimensional computation should remain the same.

This could be a worthwhile target for v0.4.0 or later.

Reproducibility -- include datasets from paper in repo

I think it would be good to include the datasets we used in the benchmarks and reported on in the paper. Perhaps an extra folder benchmarks can be created with scripts that people can use to test performance, and at least the datasets we used in the paper? I think that would be a good service for people interested in the library and possibly in finding any remaining bottlenecks.

[CPP] Variable names in binomial_coeff_table

This was discussed internally with @MonkeyBreaker and I'm just recording it here for convenience.

I have a suspicion that the variable names in

giotto-ph/gph/src/ripser.h

Lines 115 to 143 in e302bf6

class binomial_coeff_table
{
using row_bc = std::vector<index_t>;
using mat_bc = std::vector<row_bc>;
mat_bc B;
public:
/* Transposed binomial table
* It's transposed because access where done over the rows and not the
* columns */
binomial_coeff_table(index_t k, index_t n) : B(n + 1, row_bc(k + 1, 0))
{
for (index_t i = 0; i <= k; ++i) {
B[0][i] = 1;
if (i <= n)
B[i][i] = 1;
for (index_t j = 1; j < std::min(i, n + 1); ++j) {
B[j][i] = B[j - 1][i - 1] + B[j][i - 1];
}
check_overflow(B[std::min(i >> 1, n)][i]);
}
}
index_t operator()(index_t k, index_t n) const
{
assert(n < B.size() && k < B[n].size() && n >= k - 1);
return B[n][k];
}
};
should be swapped for better understanding of the code's intent. I may be wrong. To be discussed!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.