Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace ripser.py and robinhood submodules with giotto-ph dependency #614

Merged
merged 6 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
[submodule "gtda/externals/ripser"]
path = gtda/externals/ripser
url = https://github.com/scikit-tda/ripser.py.git
[submodule "gtda/externals/gudhi-devel"]
path = gtda/externals/gudhi-devel
url = https://github.com/giotto-ai/gudhi-devel
Expand All @@ -14,6 +11,3 @@
[submodule "gtda/externals/pybind11"]
path = gtda/externals/pybind11
url = https://github.com/pybind/pybind11
[submodule "gtda/externals/robinhood"]
path = gtda/externals/robinhood
url = https://github.com/martinus/robin-hood-hashing
76 changes: 0 additions & 76 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,59 +9,9 @@ include_directories(${Boost_INCLUDE_DIRS})

find_package(OpenMP)

set(RIPSER_SRC_DIR "gtda/externals/ripser")
set(GUDHI_SRC_DIR "gtda/externals/gudhi-devel/src")
set(HERA_DIR "gtda/externals/hera")
set(EIGEN_DIR "gtda/externals/eigen")
set(ROBINHOOD_DIR "gtda/externals/robinhood")

#######################################################################
# Ripser #
#######################################################################

pybind11_add_module(gtda_ripser MODULE "${BINDINGS_DIR}/ripser_bindings.cpp")
set_property(TARGET gtda_ripser PROPERTY CXX_STANDARD 14)

if(OpenMP_FOUND)
target_link_libraries(gtda_ripser PRIVATE OpenMP::OpenMP_CXX)
endif()

target_compile_definitions(gtda_ripser PRIVATE ASSEMBLE_REDUCTION_MATRIX=1)
target_include_directories(gtda_ripser PRIVATE "${RIPSER_SRC_DIR}/ripser")
target_compile_definitions(gtda_ripser PRIVATE USE_ROBINHOOD_HASHMAP=1)
target_include_directories(gtda_ripser PRIVATE "${ROBINHOOD_DIR}/src/include")

if(MSVC)
target_compile_options(gtda_ripser PUBLIC $<$<CONFIG:RELEASE>: /Wall /O2>)
target_compile_options(gtda_ripser PUBLIC $<$<CONFIG:DEBUG>:/O1 /DEBUG:FULL /Zi /Zo>)
else()
target_compile_options(gtda_ripser PUBLIC $<$<CONFIG:RELEASE>: -O3>)
target_compile_options(gtda_ripser PUBLIC $<$<CONFIG:DEBUG>: -O2 -ggdb -D_GLIBCXX_DEBUG>)
endif()

#######################################################################
# Ripser - Coefficient enable #
#######################################################################

pybind11_add_module(gtda_ripser_coeff MODULE "${BINDINGS_DIR}/ripser_bindings.cpp")
set_property(TARGET gtda_ripser_coeff PROPERTY CXX_STANDARD 14)

if(OpenMP_FOUND)
target_link_libraries(gtda_ripser_coeff PRIVATE OpenMP::OpenMP_CXX)
endif()

target_compile_definitions(gtda_ripser_coeff PRIVATE USE_COEFFICIENTS=1 ASSEMBLE_REDUCTION_MATRIX=1)
target_include_directories(gtda_ripser_coeff PRIVATE "${RIPSER_SRC_DIR}/ripser")
target_compile_definitions(gtda_ripser_coeff PRIVATE USE_ROBINHOOD_HASHMAP=1)
target_include_directories(gtda_ripser_coeff PRIVATE "${ROBINHOOD_DIR}/src/include")

if(MSVC)
target_compile_options(gtda_ripser_coeff PUBLIC $<$<CONFIG:RELEASE>: /Wall /O2>)
target_compile_options(gtda_ripser_coeff PUBLIC $<$<CONFIG:DEBUG>:/O1 /DEBUG:FULL /Zi /Zo>)
else()
target_compile_options(gtda_ripser_coeff PUBLIC $<$<CONFIG:RELEASE>: -O3>)
target_compile_options(gtda_ripser_coeff PUBLIC $<$<CONFIG:DEBUG>: -O2 -ggdb -D_GLIBCXX_DEBUG>)
endif()

#######################################################################
# Wasserstein #
Expand Down Expand Up @@ -338,29 +288,3 @@ else()
target_compile_options(gtda_cech_complex PUBLIC $<$<CONFIG:RELEASE>: -Ofast -shared -pthread -fPIC -fwrapv -Wall -fno-strict-aliasing -frounding-math>)
target_compile_options(gtda_cech_complex PUBLIC $<$<CONFIG:DEBUG>:-O2 -ggdb -D_GLIBCXX_DEBUG>)
endif()

#######################################################################
# Collapser #
#######################################################################

pybind11_add_module(gtda_collapser MODULE "${BINDINGS_DIR}/collapser_bindings.cpp")
set_property(TARGET gtda_collapser PROPERTY CXX_STANDARD 14)

if(OpenMP_FOUND)
target_link_libraries(gtda_collapser PRIVATE OpenMP::OpenMP_CXX)
endif()

target_link_libraries(gtda_collapser LINK_PUBLIC ${Boost_LIBRARIES})
target_compile_definitions(gtda_collapser PRIVATE BOOST_RESULT_OF_USE_DECLTYPE=1 BOOST_ALL_NO_LIB=1 BOOST_SYSTEM_NO_DEPRECATED=1)

target_include_directories(gtda_collapser PRIVATE "${GUDHI_SRC_DIR}/common/include")
target_include_directories(gtda_collapser PRIVATE "${GUDHI_SRC_DIR}/Collapse/include")
target_include_directories(gtda_collapser PRIVATE "${EIGEN_DIR}")

if(MSVC)
target_compile_options(gtda_collapser PUBLIC $<$<CONFIG:RELEASE>: /O2 /Wall /fp:strict>)
target_compile_options(gtda_collapser PUBLIC $<$<CONFIG:DEBUG>:/O1 /DEBUG:FULL /Zi /Zo>)
else()
target_compile_options(gtda_collapser PUBLIC $<$<CONFIG:RELEASE>: -Ofast -shared -pthread -fPIC -fwrapv -Wall -fno-strict-aliasing -frounding-math>)
target_compile_options(gtda_collapser PUBLIC $<$<CONFIG:DEBUG>:-O2 -ggdb -D_GLIBCXX_DEBUG>)
endif()
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- task: Cache@2
inputs:
key: '"ccache-wheels-v2021.07.27" | $(Agent.OS) | "$(python.version)"'
key: '"ccache-wheels-v2021.12.29" | $(Agent.OS) | "$(python.version)"'
path: $(CCACHE_DIR)
displayName: ccache

Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:

- task: Cache@2
inputs:
key: '"ccache-v2021.07.27" | $(Agent.OS) | "$(python.version)"'
key: '"ccache-v2021.12.29" | $(Agent.OS) | "$(python.version)"'
path: $(CCACHE_DIR)
displayName: ccache

Expand Down
10 changes: 4 additions & 6 deletions examples/persistent_homology_graphs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -507,9 +507,7 @@
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": false
},
"metadata": {},
"outputs": [],
"source": [
"X_ggd = GraphGeodesicDistance(directed=True, unweighted=True).fit_transform([directed_circle])\n",
Expand Down Expand Up @@ -651,13 +649,13 @@
"- Persistence diagrams are great for data exploration, but to feed their content to machine learning algorithms one must make sure the algorithm used is **independent of the relative ordering** of the birth-death pairs in each homology dimension. [gtda.diagrams](https://giotto-ai.github.io/gtda-docs/latest/modules/diagrams.html) contains a suite of vector representations, feature extraction methods and kernel methods that convert persistence diagrams into data structures ready for machine learning algorithms. Simple examples of their use are contained in [Topological feature extraction using VietorisRipsPersistence and PersistenceEntropy](https://giotto-ai.github.io/gtda-docs/latest/notebooks/vietoris_rips_quickstart.html), [Classifying 3D shapes](https://giotto-ai.github.io/gtda-docs/latest/notebooks/classifying_shapes.html) and [Lorenz attractor](https://giotto-ai.github.io/gtda-docs/latest/notebooks/lorenz_attractor.html).\n",
"- In addition to ``GraphGeodesicDistance``, [gtda.graphs](https://giotto-ai.github.io/gtda-docs/latest/modules/graphs.html) also contains transformers for the creation of graphs from point cloud or time series data.\n",
"- Despite the name, [gtda.point_clouds](https://giotto-ai.github.io/gtda-docs/latest/modules/point_clouds.html) contains transformers for the alteration of distance matrices (which are just adjacency matrices of weighted graphs) as a preprocessing step for persistent homology.\n",
"- ``VietorisRipsPersistence`` builds on the [ripser.py](https://ripser.scikit-tda.org/index.html) project. Its website contains two tutorials on additional ways in which graphs can be constructed from [time series data](https://ripser.scikit-tda.org/notebooks/Lower%20Star%20Time%20Series.html) or [image data](https://ripser.scikit-tda.org/notebooks/Lower%20Star%20Image%20Filtrations.html), and fed to the clique complex filtration construction. With a few simple modifications, the code can be adapted to the API of ``VietorisRipsPersistence``."
"- ``VietorisRipsPersistence`` builds on the [giotto-ph](https://github.com/giotto-ai/giotto-ph) and [ripser.py](https://ripser.scikit-tda.org/index.html) projects. The latter's website contains two tutorials on additional ways in which graphs can be constructed from [time series data](https://ripser.scikit-tda.org/notebooks/Lower%20Star%20Time%20Series.html) or [image data](https://ripser.scikit-tda.org/notebooks/Lower%20Star%20Image%20Filtrations.html), and fed to the clique complex filtration construction. With a few simple modifications, the code can be adapted to the API of ``VietorisRipsPersistence``."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -671,7 +669,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.9.2"
}
},
"nbformat": 4,
Expand Down
10 changes: 2 additions & 8 deletions gtda/externals/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,17 @@

from .modules.gtda_bottleneck import bottleneck_distance
from .modules.gtda_wasserstein import wasserstein_distance
from .modules.gtda_collapser import flag_complex_collapse_edges_dense, \
flag_complex_collapse_edges_sparse, flag_complex_collapse_edges_coo
from .python import ripser, SparseRipsComplex, CechComplex, CubicalComplex, \
from .python import SparseRipsComplex, CechComplex, CubicalComplex, \
PeriodicCubicalComplex, SimplexTree, WitnessComplex, StrongWitnessComplex

__all__ = [
'bottleneck_distance',
'wasserstein_distance',
'ripser',
'SparseRipsComplex',
'CechComplex',
'CubicalComplex',
'PeriodicCubicalComplex',
'SimplexTree',
'WitnessComplex',
'StrongWitnessComplex',
'flag_complex_collapse_edges_dense',
'flag_complex_collapse_edges_sparse',
'flag_complex_collapse_edges_coo'
'StrongWitnessComplex'
]
142 changes: 0 additions & 142 deletions gtda/externals/bindings/collapser_bindings.cpp

This file was deleted.

57 changes: 0 additions & 57 deletions gtda/externals/bindings/ripser_bindings.cpp

This file was deleted.

1 change: 0 additions & 1 deletion gtda/externals/python/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .ripser_interface import ripser
from .cubical_complex_interface import CubicalComplex
from .simplex_tree_interface import SimplexTree
from .periodic_cubical_complex_interface import PeriodicCubicalComplex
Expand Down
Loading