Skip to content

Commit

Permalink
Refactor (#4)
Browse files Browse the repository at this point in the history
* get rid of double/float, improve naming

* Remove sorted_id_to_value_ vector from Filtration

* Use combinatorial enumeration as simplex Uid (as in Ripser)

* Check for Ctrl-C in Python

* Add threading to boundary matrix computation

* Breaking: id of cell is always reset to its position in vector
To allow multi-threaded filtration initialization.
Also add multithreading to more places (copying matrix in parallel reduction,
setting pivots, etc).
  • Loading branch information
anigmetov authored Dec 12, 2024
1 parent 333a708 commit cad05cb
Show file tree
Hide file tree
Showing 62 changed files with 2,077 additions and 1,898 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,20 @@ from
arXiv preprint arXiv:2203.16748 (2022)."*](https://arxiv.org/abs/2203.16748)

Currently it supports computation of lower-star persistence
of scalar functions on regular grids or of user-defined
of scalar functions on regular grids, Vietoris-Rips filtrations or of user-defined
filtrations (where each simplex needs to be created manually).
It can compute image, kernel and cokernel persistence.
Oineus provides differentiable filtrations to simplify topological
optimization. It can compute zero-persistence diagrams. It provides
a convenience function for mapping cylinder construction.
It is written in C++ with python bindings (pybind11).

## Installation

```shell
pip install oineus
```

## Compilation

Oineus requires C++17 standard and python3.
Expand Down
16 changes: 11 additions & 5 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,23 @@ add_custom_target (oineus ALL ${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_SOURCE_DIR}/oineus ${MODULE_OUTPUT_DIRECTORY}/oineus
DEPENDS ${OINEUS_PYTHON})

set(OINEUS_PYTHON_INT "long int" CACHE STRING "Choose the Int type in Python bindings, options are: int, long int, long long int." FORCE)
set_property(CACHE OINEUS_PYTHON_INT PROPERTY STRINGS "int" "long int" "long long int")

set(OINEUS_PYTHON_REAL "double" CACHE STRING "Choose the Real type in Python bindings, options are: float, double." FORCE)
set_property(CACHE OINEUS_PYTHON_REAL PROPERTY STRINGS "float" "double")

pybind11_add_module (_oineus oineus.cpp
oineus_common.cpp
oineus_decomposition.cpp
oineus_index_diagram.cpp
oineus_fil_dgm_simplex_double.cpp
oineus_fil_dgm_simplex_float.cpp
oineus_functions_double.cpp
oineus_functions_float.cpp
oineus_diagram.cpp
oineus_cells.cpp
oineus_filtration.cpp
oineus_kicr.cpp
oineus_functions.cpp
oineus_top_optimizer.cpp
)
target_compile_definitions(_oineus PRIVATE OINEUS_PYTHON_REAL=${OINEUS_PYTHON_REAL} OINEUS_PYTHON_INT=${OINEUS_PYTHON_INT})
target_link_libraries (_oineus PRIVATE ${libraries})
target_include_directories (_oineus PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/../../include"
"${CMAKE_CURRENT_SOURCE_DIR}/../../extern")
Expand Down
110 changes: 0 additions & 110 deletions bindings/python/example_cone_diff.py

This file was deleted.

21 changes: 7 additions & 14 deletions bindings/python/oineus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,12 @@ PYBIND11_MODULE(_oineus, m)
{
m.doc() = "Oineus python bindings";

// std::string float_suffix = "_float";
std::string double_suffix = "_double";
// std::string double_suffix = "";

init_oineus_common_int(m);
init_oineus_common_diagram_int(m);
init_oineus_common_decomposition_int(m);

// init_oineus_functions_float(m, float_suffix);
// init_oineus_fil_dgm_simplex_float(m, float_suffix);

init_oineus_functions_double(m, double_suffix);
init_oineus_fil_dgm_simplex_double(m, double_suffix);

init_oineus_common(m);
init_oineus_cells(m);
init_oineus_filtration(m);
init_oineus_common_decomposition(m);
init_oineus_diagram(m);
init_oineus_functions(m);
init_oineus_kicr(m);
init_oineus_top_optimizer(m);
}
Loading

0 comments on commit cad05cb

Please sign in to comment.