Skip to content
Draft
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
379 commits
Select commit Hold shift + click to select a range
d19ecb8
doc
hschreiber Mar 13, 2025
02a7ef4
Degree_rips_bifiltration
hschreiber Mar 14, 2025
36dd35b
Degree_rips_bifiltration unitary tests
hschreiber Mar 18, 2025
7d3b0dd
Degree_rips_bifiltration unitary tests
hschreiber Mar 18, 2025
5d3d766
doc
hschreiber Mar 18, 2025
a0799a0
doc
hschreiber Mar 18, 2025
bfe8e26
doc
hschreiber Mar 18, 2025
610e028
doc
hschreiber Mar 18, 2025
9a71cd1
add converters between classes
hschreiber Mar 18, 2025
cb71e10
merge simple_mdspan branche
hschreiber Mar 18, 2025
7ea7097
small fix
hschreiber Mar 19, 2025
ec91ec3
forgotten delete after new in tests
hschreiber Mar 20, 2025
15ed6e0
forgotten delete after new in tests
hschreiber Mar 20, 2025
2fa3caf
Windows fix?
hschreiber Mar 20, 2025
8fa1ff6
Windows fix?
hschreiber Mar 20, 2025
b938f79
char* to void* for comparision
hschreiber Mar 21, 2025
0d4ad0c
Merge remote-tracking branch 'origin/simple_mdspan' into multi_filtra…
hschreiber Mar 21, 2025
d405253
upstream merge
hschreiber Mar 21, 2025
74680ce
number of parameters for simplex tree
hschreiber Mar 21, 2025
b697d15
Box & Point
hschreiber Mar 21, 2025
9cc104d
line
hschreiber Apr 23, 2025
a10d98b
Merge branch 'GUDHI:master' into multi_persistence
hschreiber Apr 23, 2025
b53998a
Merge branch 'multi_persistence' of github.com:hschreiber/gudhi-devel…
hschreiber Apr 23, 2025
11e123d
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Apr 23, 2025
c70741c
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Apr 23, 2025
1527695
multify/flatten helpers simplified + renamed
hschreiber Apr 23, 2025
364df58
add lex comparator
hschreiber Apr 28, 2025
b8ec063
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Apr 28, 2025
dd4014a
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Apr 28, 2025
1f98cb6
start Truc
hschreiber Apr 28, 2025
f8fa2ca
Merge branch 'GUDHI:master' into multi_persistence
hschreiber Apr 28, 2025
e5ae91b
add colex comparator
hschreiber Apr 29, 2025
ed4472b
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Apr 29, 2025
42bc7e3
forgotten forward declarations
hschreiber Apr 29, 2025
561c4d3
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Apr 29, 2025
6f7e3ca
truc part2
hschreiber Apr 29, 2025
7f0c243
more reliable infinity values
hschreiber Apr 30, 2025
6f77ee4
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Apr 30, 2025
30e4e78
Truc part3
hschreiber Apr 30, 2025
36c576f
Merge remote-tracking branch 'origin/representative_cycles' into mult…
hschreiber Jul 2, 2025
b9aec35
Truc part4
hschreiber Jul 8, 2025
5faefc8
Truc part5
hschreiber Jul 10, 2025
a4ba64b
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Jul 11, 2025
2f65c42
operator>> for all multi filtration value types
hschreiber Jul 11, 2025
91238b5
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Jul 11, 2025
cdbb855
Truc part6
hschreiber Jul 24, 2025
bb9a0d0
Merge remote-tracking branch 'origin/matrix_changes' into multi_persi…
hschreiber Jul 24, 2025
cb5d804
Truc part6
hschreiber Jul 24, 2025
e4a90b2
Truc part7
hschreiber Jul 25, 2025
31377c6
Slicer io
hschreiber Jul 29, 2025
f1f7667
doc
hschreiber Jul 29, 2025
fa9f0b1
doc
hschreiber Jul 30, 2025
8cc4b39
doc
hschreiber Jul 31, 2025
cd8dab0
doc
hschreiber Aug 12, 2025
d527806
doc
hschreiber Aug 12, 2025
6105d26
doc
hschreiber Aug 12, 2025
dc22edd
Merge branch 'GUDHI:master' into multi_persistence
hschreiber Aug 12, 2025
f260f71
doc
hschreiber Aug 12, 2025
1b487b4
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Aug 12, 2025
e241468
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Aug 12, 2025
e1a980f
Merge remote-tracking branch 'origin/matrix_changes' into multi_persi…
hschreiber Aug 12, 2025
e0c7188
tmp merge 1
hschreiber Aug 12, 2025
e88f9bc
Merge remote-tracking branch 'origin/general_cohomology' into multi_p…
hschreiber Aug 12, 2025
2ca51e1
add move constructors to multi filtration value classes
hschreiber Aug 13, 2025
40366e9
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Aug 13, 2025
a45b5dd
cleanup
hschreiber Aug 13, 2025
a89f038
removal of the useless Co template argument of Multi_parameter_generator
hschreiber Aug 21, 2025
7c0dd5d
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Aug 21, 2025
6af0a0a
bug fix in Dynamic_multi_parameter_filtration
hschreiber Aug 22, 2025
3f128e6
upstream merge
hschreiber Aug 22, 2025
0b9bbed
several fixes + re-arrangements
hschreiber Aug 22, 2025
ef747b6
fixes
hschreiber Sep 8, 2025
4dc66bd
upstream merge
hschreiber Sep 8, 2025
c1cd900
upstream merge
hschreiber Sep 8, 2025
2ad6605
upstream merge
hschreiber Sep 8, 2025
b7bc7bf
fixes
hschreiber Sep 8, 2025
2fdcc13
Merge remote-tracking branch 'origin/general_cohomology' into multi_p…
hschreiber Sep 8, 2025
8fcf844
add example from david's branch
hschreiber Sep 8, 2025
371c612
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Sep 8, 2025
7e40d31
first update
hschreiber Sep 8, 2025
f9aaee0
second update
hschreiber Sep 8, 2025
c8f49da
third update
hschreiber Sep 8, 2025
bf02e13
fourth update
hschreiber Sep 8, 2025
a4c67cf
conversion methods
hschreiber Sep 10, 2025
9639b67
windows fix?
hschreiber Sep 11, 2025
8e811a9
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Sep 11, 2025
8cc7ccf
more general minus infinity value
hschreiber Sep 11, 2025
41784e1
upstream merge
hschreiber Sep 11, 2025
100d7ae
windows fix?
hschreiber Sep 11, 2025
165029e
typo
hschreiber Sep 12, 2025
e4a25d1
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Sep 12, 2025
07ab8d0
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Sep 12, 2025
4a0b8d4
Merge remote-tracking branch 'hschreiber/multi_persistence' into Mult…
hschreiber Sep 12, 2025
a53e8ab
most persistent cycle
hschreiber Sep 12, 2025
7c89d6a
more general build_complex_from_simplex_tree
hschreiber Sep 15, 2025
1fcfcb7
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Nov 17, 2025
9897e63
inverts first and second parameter for Degree_rips_filtration
hschreiber Nov 18, 2025
a993729
changes push_to and pull_to of Degree_rips_filtration to be more cons…
hschreiber Nov 19, 2025
0692eb3
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Nov 20, 2025
ef01751
better bounds for factorize_* in Degree_rips_filtration
hschreiber Nov 20, 2025
0fb5492
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Nov 21, 2025
9303a96
Merge remote-tracking branch 'origin/matrix_fix' into vinyard_interface
hschreiber Nov 21, 2025
b22efef
Merge remote-tracking branch 'origin/matrix_fix' into vinyard_interface
hschreiber Nov 25, 2025
8cd1e7e
first vineyard batch
hschreiber Nov 26, 2025
8d54fd2
vineyard python interface
hschreiber Nov 28, 2025
83d2690
vineyard rep cycles interface
hschreiber Dec 4, 2025
0bd504b
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Dec 5, 2025
6841e2f
add possibility of threshold for plotting in vineyard module
hschreiber Dec 9, 2025
087b692
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Dec 9, 2025
877f580
small corrections + method to test vineyard validity
hschreiber Dec 11, 2025
a6692c5
threshold for get vineyard methods
hschreiber Dec 12, 2025
d756463
revisit color in vineyard plotting + thresholds for getters
hschreiber Dec 15, 2025
7875f69
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Dec 16, 2025
befb1f5
vineyard python doc
hschreiber Dec 17, 2025
993c8a1
match cycles with bars in Vineyard
hschreiber Dec 18, 2025
8b4f630
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Dec 18, 2025
78aad6b
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Dec 19, 2025
153a887
change of behaviour for project_onto_grid
hschreiber Dec 19, 2025
6c09cb3
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Dec 19, 2025
26378a4
upstream merge
hschreiber Dec 19, 2025
6ffe07a
add copy constructor for Slicer with different templates
hschreiber Dec 19, 2025
6cbffc3
small fixes
hschreiber Dec 19, 2025
2815ff9
Merge remote-tracking branch 'hschreiber/multi_persistence' into Mult…
hschreiber Dec 19, 2025
b1d9d16
Merge branch 'GUDHI:master' into multi_persistence
hschreiber Jan 13, 2026
0037371
parallel_for for push_to and coarsen_on_grid
hschreiber Jan 14, 2026
a6c52e9
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Jan 14, 2026
b04f1b8
upstream merge
hschreiber Jan 16, 2026
dffda0b
rename vineyard_update
hschreiber Jan 16, 2026
c4e99d1
enable cubical complex for vineyard
hschreiber Jan 16, 2026
5d2c187
Merge remote-tracking branch 'origin/vinyard_interface' into multi_pe…
hschreiber Jan 16, 2026
6efad53
upstream merge
hschreiber Jan 16, 2026
beb8ff7
Merge remote-tracking branch 'origin/matrix_changes' into vinyard_int…
hschreiber Jan 16, 2026
20db201
Merge remote-tracking branch 'origin/vinyard_interface' into multi_pe…
hschreiber Jan 16, 2026
13a4d94
factorization with new vineyard module
hschreiber Jan 20, 2026
59e2340
adapted to multi persistence module
hschreiber Jan 20, 2026
8e2a7a4
Merge remote-tracking branch 'origin/vinyard_interface' into multi_pe…
hschreiber Jan 20, 2026
ed13684
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Jan 22, 2026
ffd488a
parallelize some multi filtration methods
hschreiber Jan 22, 2026
3659477
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Jan 22, 2026
0ec6796
micro warning fix
hschreiber Jan 22, 2026
1df9491
copyright year correction
hschreiber Jan 22, 2026
1daac9c
copyright year correction
hschreiber Jan 22, 2026
0aad5d0
doc
hschreiber Jan 23, 2026
35ea22c
Update vineyard_base.h cycle type
hschreiber Feb 2, 2026
5123657
maybe_unused
hschreiber Feb 9, 2026
1cfc9e3
Merge branch 'matrix_changes' of github.com:hschreiber/gudhi-devel in…
hschreiber Feb 9, 2026
6141777
fix ru rep cycles parallel
hschreiber Feb 9, 2026
eb7483e
generalize insert_maximal_cell + compute_dynamic_persistence_from_fil…
hschreiber Feb 11, 2026
f56a1c2
better template for compute_dynamic_persistence_from_file
hschreiber Feb 11, 2026
09a3743
doc
hschreiber Feb 11, 2026
f9296c9
vineyard unit test part1
hschreiber Feb 12, 2026
b4df673
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Feb 12, 2026
443f0c4
Merge branch 'vinyard_interface' of github.com:hschreiber/gudhi-devel…
hschreiber Feb 12, 2026
729d4a7
vineyard unit test part1
hschreiber Feb 12, 2026
d295a24
vineyard unit test part2
hschreiber Feb 13, 2026
ec15df2
vineyard example + doc
hschreiber Feb 16, 2026
d9456df
python doc
hschreiber Feb 17, 2026
cc251c6
vineyard py test
hschreiber Feb 18, 2026
7ec70b3
vineyard doc
hschreiber Feb 19, 2026
83b1230
missing examples in list
hschreiber Feb 20, 2026
2319d36
Merge branch 'GUDHI:master' into matrix_changes
hschreiber Feb 20, 2026
6fa2c0a
split for PR
hschreiber Feb 20, 2026
0316e53
Merge remote-tracking branch 'origin/master' into multi_filtrations
hschreiber Feb 20, 2026
c17740c
small fixes in Degree_rips
hschreiber Feb 20, 2026
49f275c
copyright fix
hschreiber Feb 20, 2026
e9238d5
copyright fix
hschreiber Feb 20, 2026
e2fa822
upstream merge
hschreiber Feb 20, 2026
7263561
copyright correction
hschreiber Feb 20, 2026
c7ad323
Merge remote-tracking branch 'origin/vinyard_interface' into multi_pe…
hschreiber Feb 20, 2026
26d7365
Merge remote-tracking branch 'hschreiber/multi_persistence' into Mult…
hschreiber Feb 20, 2026
0760324
Merge remote-tracking branch 'origin/matrix_insert' into vinyard_inte…
hschreiber Feb 20, 2026
754874d
review comment fixes
hschreiber Feb 25, 2026
120eb12
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Feb 25, 2026
9b346af
add add_gudhi_py_test_with_file_path to fix vineyard test
hschreiber Feb 25, 2026
5e88fd8
add add_gudhi_py_test_with_file_path to fix vineyard test
hschreiber Feb 25, 2026
d94beb5
py vineyard test fix
hschreiber Feb 25, 2026
9b5f3d7
py vineyard test fix
hschreiber Feb 25, 2026
041a4ea
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Feb 25, 2026
50ad475
replacing match syntax for python 3.9
hschreiber Feb 27, 2026
f9d20ea
more consistent renaming
hschreiber Feb 27, 2026
376e9d2
typing fix for python 3.9
hschreiber Feb 27, 2026
cfc4c45
typing fix for python 3.9
hschreiber Feb 27, 2026
48a75ef
doc
hschreiber Mar 2, 2026
b8ce1cc
formatting
hschreiber Mar 2, 2026
785c385
path manipulation fix for python 3.9
hschreiber Mar 3, 2026
9f4ba44
add as_type version
hschreiber Mar 4, 2026
9fe27c4
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber Mar 4, 2026
5304aab
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber Mar 4, 2026
8880d85
small adds
hschreiber Mar 4, 2026
895f4b1
Merge branch 'GUDHI:master' into multi_persistence
hschreiber Mar 30, 2026
98d39ad
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Mar 30, 2026
b2fcd07
Merge branch 'GUDHI:master' into multi_persistence
hschreiber Mar 31, 2026
6ae25bd
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Mar 31, 2026
5a30d56
multipers update
hschreiber Mar 31, 2026
5b84c8d
Merge remote-tracking branch 'origin/vinyard_interface' into multi_pe…
hschreiber Mar 31, 2026
553ad34
chatty optimization for unordered set column
hschreiber Mar 31, 2026
1d0a44e
fix underflow
DavidLapous Apr 1, 2026
2609b9a
complex scc write-read fix
hschreiber Apr 1, 2026
7020150
Merge pull request #1 from DavidLapous/patch-1
hschreiber Apr 1, 2026
227cbff
doc
hschreiber Apr 21, 2026
5776f65
upstream merge
hschreiber Apr 21, 2026
c68cc8f
Merge branch 'vinyard_interface' of github.com:hschreiber/gudhi-devel…
hschreiber Apr 21, 2026
4b6c8de
doc
hschreiber Apr 21, 2026
26b5995
vineyard python tests redone part1
hschreiber Apr 22, 2026
c68c406
vineyard python tests redone part2
hschreiber Apr 27, 2026
e320574
Merge branch 'GUDHI:master' into vinyard_interface
hschreiber Apr 27, 2026
86cd753
separating vineyard classes from plotting
hschreiber Apr 29, 2026
8c34771
generalization of vineyard plot options
hschreiber Apr 29, 2026
5ae5690
vineyard plot better handling of inf vines
hschreiber Apr 30, 2026
4f22b02
vineyard plot better handling of inf vines
hschreiber Apr 30, 2026
bc09882
more arguments for vine plotting
hschreiber May 4, 2026
48322d6
Merge remote-tracking branch 'origin/vinyard_interface' into multi_pe…
hschreiber May 4, 2026
8d70f9d
Merge branch 'multi_persistence' of github.com:hschreiber/gudhi-devel…
hschreiber May 4, 2026
373c525
multi filtration project to grid fix
hschreiber May 8, 2026
5122dd6
doc update for filtration_simplex_range
hschreiber May 8, 2026
cdbe4e3
simplex tree operator<< and >> as friend
hschreiber May 8, 2026
8e77c35
upstream merge
hschreiber May 8, 2026
525228d
replacing filtration_simplex_range with for_each_simplex in operator<…
hschreiber May 8, 2026
8d435db
CI fix ?
hschreiber May 12, 2026
916728b
review comments for multi simplex tree example
hschreiber May 12, 2026
6420fc0
CI fix ?
hschreiber May 12, 2026
f3a2573
factorization + Windows fix
hschreiber May 18, 2026
f18cf37
factorization + Windows fix
hschreiber May 18, 2026
a31e611
generalization of module helpers input and output
hschreiber May 20, 2026
5811b04
Merge branch 'GUDHI:master' into multi_filtrations
hschreiber May 20, 2026
3ac4f1f
compute_coordinates_in_grid template order
hschreiber May 20, 2026
3bc4f80
upstream merge
hschreiber May 20, 2026
307d51d
Merge remote-tracking branch 'origin/multi_filtrations' into multi_pe…
hschreiber May 20, 2026
cf127b2
Merge branch 'multi_persistence' of github.com:hschreiber/gudhi-devel…
hschreiber May 20, 2026
3a3657c
contiguous numpy array condition
hschreiber May 20, 2026
eeb0845
Doc + set_slicer
hschreiber May 22, 2026
3147d53
tiny simplification
hschreiber May 22, 2026
96d28bd
doc
hschreiber May 28, 2026
b5ccb03
summand unit tests
hschreiber May 29, 2026
880dd7b
summand unit tests
hschreiber Jun 1, 2026
f0674af
unit tests + removing box from module
hschreiber Jun 12, 2026
fa2c845
module unit tests
hschreiber Jun 16, 2026
8d97c89
module unit tests
hschreiber Jun 17, 2026
4ae8c4e
module unit tests
hschreiber Jun 17, 2026
b29c412
add bars on batch of lines for module
hschreiber Jun 17, 2026
64bbb44
typo
hschreiber Jun 18, 2026
cfc2d53
move summand flat methods to python binding
hschreiber Jun 18, 2026
47e5eba
add num_parameter to simplex tree
hschreiber Jun 19, 2026
bb096fa
More precise check for dynamic multi filtrations
hschreiber Jun 19, 2026
973f85a
upstream merge
hschreiber Jun 19, 2026
01131c6
upstream merge
hschreiber Jun 19, 2026
2ecb281
Merge remote-tracking branch 'hschreiber/multi_persistence' into Mult…
hschreiber Jun 19, 2026
e965513
upstream merge
hschreiber Jun 19, 2026
b5c1fd5
remove unnecessary nanobind::any_contig
hschreiber Jun 19, 2026
e76dd00
Merge remote-tracking branch 'hschreiber/multi_persistence' into Mult…
hschreiber Jun 19, 2026
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
2 changes: 2 additions & 0 deletions src/Persistent_cohomology/test/betti_numbers_unit_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ struct MiniSTOptions : Gudhi::Simplex_tree_options_full_featured {
static const bool store_key = true;
// I have few vertices
typedef short Vertex_handle;

static const bool is_multi_parameter = false;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I already commented somewhere that we should remove this line (and the same in several places) because is_multi_parameter is already false in the base class.

};

using Mini_simplex_tree = Gudhi::Simplex_tree<MiniSTOptions>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ struct MiniSTOptions {
static const bool contiguous_vertices = false;
static const bool link_nodes_by_label = false;
static const bool stable_simplex_handles = false;
static const bool is_multi_parameter = false;
};

using Mini_simplex_tree = Gudhi::Simplex_tree<MiniSTOptions>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ struct Simplex_tree_options_stable_simplex_handles {
static const bool contiguous_vertices = false;
static const bool link_nodes_by_label = true;
static const bool stable_simplex_handles = true;
static const bool is_multi_parameter = false;
};

int main(int argc, char *argv[]) {
Expand Down
2 changes: 2 additions & 0 deletions src/Simplex_tree/concept/SimplexTreeOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ struct SimplexTreeOptions {
static const bool link_nodes_by_label;
/// If true, Simplex_handle will not be invalidated after insertions or removals.
static const bool stable_simplex_handles;
/// If true, assumes that Filtration_value is vector-like instead of float-like. This also assumes that Filtration_values is a class, which has a push_to method to push a filtration value $x$ onto $this>=0$.
Comment thread
DavidLapous marked this conversation as resolved.
Outdated
static const bool is_multi_parameter;
};

7 changes: 7 additions & 0 deletions src/Simplex_tree/example/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ if(TARGET TBB::tbb)
endif()
add_test(NAME Simplex_tree_example_mini_simplex_tree COMMAND $<TARGET_FILE:Simplex_tree_example_mini_simplex_tree>)

add_executable ( Simplex_tree_multi_example simplex_tree_multi.cpp )
if(TARGET TBB::tbb)
target_link_libraries(Simplex_tree_multi_example TBB::tbb)
endif()
add_test(NAME Simplex_tree_multi_example COMMAND $<TARGET_FILE:Simplex_tree_multi_example>)


# An example with Simplex-tree using CGAL alpha_shapes_3
if(GMP_FOUND AND NOT CGAL_VERSION VERSION_LESS 4.11.0)
add_executable ( Simplex_tree_example_alpha_shapes_3_from_off example_alpha_shapes_3_simplex_tree_from_off_file.cpp )
Expand Down
56 changes: 56 additions & 0 deletions src/Simplex_tree/example/simplex_tree_multi.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/* This file is part of the Gudhi Library - https://gudhi.inria.fr/ - which is released under MIT.
* See file LICENSE or go to https://gudhi.inria.fr/licensing/ for full license details.
* Author(s): David Loiseaux
*
* Copyright (C) 2023 Inria
*
* Modification(s):
* - YYYY/MM Author: Description of the modification
*/

#include <gudhi/Simplex_tree.h>
#include <gudhi/Simplex_tree/Simplex_tree_multi.h>

#include <iostream>
#include <initializer_list>

struct ST_MULTI {
public:
Comment thread
DavidLapous marked this conversation as resolved.
Outdated
typedef Gudhi::linear_indexing_tag Indexing_tag;
typedef int Vertex_handle;
typedef float value_type;
using Filtration_value = Gudhi::multiparameter::multi_filtrations::Finitely_critical_multi_filtration<value_type>;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nested multiparameter::multi_filtrations feel a bit redundant, but I guess it isn't that bad.

typedef std::uint32_t Simplex_key;
static const bool store_key = true;
static const bool store_filtration = true;
static const bool contiguous_vertices = false;
static const bool link_nodes_by_label = true;
static const bool stable_simplex_handles = false;
static const bool is_multi_parameter = true;
};

using ST = Gudhi::Simplex_tree<ST_MULTI>;


int main() {
ST st;

/* Complex to build. */
/* 1 */
/* o */
/* /X\ */
/* o---o---o */
/* 2 0 3 */

auto triangle012 = {0, 1, 2};
auto edge03 = {0, 3};
st.insert_simplex_and_subfaces(triangle012, {1,2,3}); // {1,2,3} can be any array-like vector-like
st.insert_simplex_and_subfaces(edge03, {4,5,6});

auto edge02 = {0, 2};
ST::Simplex_handle e = st.find(edge02);
// Finitely_critical_multi_filtration has an operator<<
std::cout << st.filtration(e) << std::endl;
assert(st.filtration(st.find(edge03)) == std::vector<float>({4,5,6}));
Comment thread
DavidLapous marked this conversation as resolved.
Outdated

}
107 changes: 76 additions & 31 deletions src/Simplex_tree/include/gudhi/Simplex_tree.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,18 @@ class Simplex_tree {
Key_simplex_base;

struct Filtration_simplex_base_real {
Filtration_simplex_base_real() : filt_(0) {}
void assign_filtration(Filtration_value f) { filt_ = f; }
Filtration_value filtration() const { return filt_; }
Filtration_simplex_base_real() : filt_{} {}
void assign_filtration(const Filtration_value& f) { filt_ = f; }
const Filtration_value& filtration() const { return filt_; }
Filtration_value& filtration() { return filt_; }

@VincentRouvreau VincentRouvreau Sep 29, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be discussed, but I am not sure we should add this method.
And if we add it we should add it to the Filtration_simplex_base_dummy one.

private:
Filtration_value filt_;
};
struct Filtration_simplex_base_dummy {
Filtration_simplex_base_dummy() {}
void assign_filtration(Filtration_value GUDHI_CHECK_code(f)) { GUDHI_CHECK(f == 0, "filtration value specified for a complex that does not store them"); }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this test f==0 do something sensible for multifiltration? Hmm, failing to compile may actually be a sensible behavior here, ok.

Filtration_value filtration() const { return 0; }
const Filtration_value& filtration() const { return null_value; }
static constexpr Filtration_value null_value={};

@VincentRouvreau VincentRouvreau Sep 29, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we say:

struct MyOptions : Simplex_tree_options_multidimensional_filtration {
  // is_multi_parameter but not store_filtration
  static const bool store_filtration = false;
};

Simplex_tree<MyOptions> stree;

We are facing the error:

gudhi-devel/src/Simplex_tree/include/gudhi/Simplex_tree.h:165:39: error: the type 'const Filtration_value' {aka 'const Gudhi::multiparameter::multi_filtrations::Finitely_critical_multi_filtration<float>'} of 'constexpr' variable 'Gudhi::Simplex_tree<MyOptions>::Filtration_simplex_base_dummy::null_value' is not literal
     static constexpr Filtration_value null_value={};
                                       ^~~~~~~~~~

But maybe this error is normal ? I was wondering to see if we should static_assert some error in this weird case.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A static_assert could be a good idea, as the multi parameter tree only differentiate it self from the standard with its filtration values. If store_filtration == false, is_multi_parameter set to true makes no sense. But the problem could also be solved by removing null_value (see Issue #977), then we can just document that is_multi_parameter is ignored if store_filtration == false.

@DavidLapous DavidLapous Oct 3, 2023

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple fix is to do a static_assert(!store_filtration || is_multi_parameter). thoughts ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess you meant static_assert(store_filtration || !is_multi_parameter) instead?

};
typedef typename std::conditional<Options::store_filtration, Filtration_simplex_base_real,
Filtration_simplex_base_dummy>::type Filtration_simplex_base;
Expand Down Expand Up @@ -576,7 +578,7 @@ class Simplex_tree {
*
* Same as `filtration()`, but does not handle `null_simplex()`.
*/
static Filtration_value filtration_(Simplex_handle sh) {
static const Filtration_value& filtration_(Simplex_handle sh) {
GUDHI_CHECK (sh != null_simplex(), "null simplex");
return sh->second.filtration();
}
Expand Down Expand Up @@ -604,18 +606,25 @@ class Simplex_tree {
* Called on the null_simplex, it returns infinity.
* If SimplexTreeOptions::store_filtration is false, returns 0.
*/
static Filtration_value filtration(Simplex_handle sh) {
static const Filtration_value& filtration(Simplex_handle sh){
if (sh != null_simplex()) {
return sh->second.filtration();
} else {
return std::numeric_limits<Filtration_value>::infinity();
return inf_;
}
}
static Filtration_value& filtration_mutable(Simplex_handle sh){
if (sh != null_simplex()) {
return sh->second.filtration();
} else {
return inf_;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already from the previous PR:

I am wondering if we could not just keep the version with the non const, as the validity of the filtration in the simplex tree is already responsibility of the user. This would avoid having to find a different name when it does exactly the same thing than filtration(). Or could there be performance issues when using non const references for numerical values (i.e., when the simplex tree is not multi)? If it is the case, an ugly way to solve this would be to return a std::conditional to switch between Filtration_value& and Filtration_value depending on the value of is_multi_parameter.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a fixed point of view on this. So its only a matter of what's the gudhi style of accessing a filtration value by reference.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If they really do the same thing, I am ok with filtration returning a non-const reference. But I wonder if filtration_mutable actually needs to return infinity for the null simplex. If we decided instead that filtration_mutable only accepts real simplices (GUDHI_CHECK that sh!=null_simplex()), it could make sense for it to be a separate function, and it would let us declare inf_ const.
IIRC (that was a while ago, so I am likely wrong), handling null_simplex was mostly for convenience for the output of persistent cohomology, not some fundamental reason.

}
}

/** \brief Sets the filtration value of a simplex.
* \exception std::invalid_argument In debug mode, if sh is a null_simplex.
*/
void assign_filtration(Simplex_handle sh, Filtration_value fv) {
void assign_filtration(Simplex_handle sh, const Filtration_value& fv) {
GUDHI_CHECK(sh != null_simplex(),
std::invalid_argument("Simplex_tree::assign_filtration - cannot assign filtration on null_simplex"));
sh->second.assign_filtration(fv);
Expand Down Expand Up @@ -822,14 +831,16 @@ class Simplex_tree {
* to the new simplex.
* If the insertion fails (the simplex is already there), the bool is set to false. If the insertion
* fails and the simplex already in the complex has a filtration value strictly bigger than 'filtration',
* and the simplex tree is not multi parameter (`SimplexTreeOptions::is_multi_parameter == false`),
* we assign this simplex with the new value 'filtration', and set the Simplex_handle field of the
* output pair to the Simplex_handle of the simplex. Otherwise, we set the Simplex_handle part to
* null_simplex.
* output pair to the Simplex_handle of the simplex. When the simplex tree is multi parameter,
* the existing filtration values are not updated. If the insertion fails for other reasons,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Does this comment only apply to this function, or also the other insertions as well?
  2. What is the rationale for not updating the value? For multi_critical, "min" is replaced by adding a critical value (and possibly removing redundant ones). For one-critical, if the insertion would turn it into multi-critical, we could throw an exception. Basically, I am wondering in what cases we are going to use insert on a simplex that may be already there and we will want it to keep its old filtration value. Is it for cases where we want to insert without caring about the filtration value, and we will manually set the filtration value later?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I think this applies to every insertion; the code was meant to work with the python interface, so I may have missed c++ only stuff.
  2. I think throwing an exception is a good idea for the one-critical one. For the multi-critical one, IIRC there were non-trivial changes to do to the current simplextree cpp insertion, and I had to cheat my way out of it: see this python interface code (warning, this is ugly). Is there an easy way to make (every) insertions work when a simplex is already there in the k-critical setting ? It's been a while since I've touched at this code.

* we set the Simplex_handle part to `null_simplex`.
*
*/
template <class RandomVertexHandleRange = std::initializer_list<Vertex_handle>>
std::pair<Simplex_handle, bool> insert_simplex_raw(const RandomVertexHandleRange& simplex,
Filtration_value filtration) {
const Filtration_value& filtration) {
Siblings * curr_sib = &root_;
std::pair<Simplex_handle, bool> res_insert;
auto vi = simplex.begin();
Expand Down Expand Up @@ -895,7 +906,7 @@ class Simplex_tree {
* .end() return input iterators, with 'value_type' Vertex_handle. */
template<class InputVertexRange = std::initializer_list<Vertex_handle>>
std::pair<Simplex_handle, bool> insert_simplex(const InputVertexRange & simplex,
Filtration_value filtration = 0) {
const Filtration_value& filtration = {}) {
auto first = std::begin(simplex);
auto last = std::end(simplex);

Expand Down Expand Up @@ -924,7 +935,7 @@ class Simplex_tree {
*/
template<class InputVertexRange = std::initializer_list<Vertex_handle>>
std::pair<Simplex_handle, bool> insert_simplex_and_subfaces(const InputVertexRange& Nsimplex,
Filtration_value filtration = 0) {
Comment thread
VincentRouvreau marked this conversation as resolved.
Outdated
const Filtration_value& filtration = {}) {
auto first = std::begin(Nsimplex);
auto last = std::end(Nsimplex);

Expand Down Expand Up @@ -953,7 +964,7 @@ class Simplex_tree {
std::pair<Simplex_handle, bool> rec_insert_simplex_and_subfaces_sorted(Siblings* sib,
ForwardVertexIterator first,
ForwardVertexIterator last,
Filtration_value filt) {
const Filtration_value& filt) {
// An alternative strategy would be:
// - try to find the complete simplex, if found (and low filtration) exit
// - insert all the vertices at once in sib
Expand All @@ -969,14 +980,17 @@ class Simplex_tree {

Simplex_handle simplex_one = insertion_result.first;
bool one_is_new = insertion_result.second;
if (!one_is_new) {
if (filtration(simplex_one) > filt) {
assign_filtration(simplex_one, filt);
} else {
// FIXME: this interface makes no sense, and it doesn't seem to be tested.
insertion_result.first = null_simplex();
if constexpr (!SimplexTreeOptions::is_multi_parameter){ // Ignores the assign part for multiparameter filtrations.
if (!one_is_new) {
if (filtration(simplex_one) > filt){
assign_filtration(simplex_one, filt);
} else {
// FIXME: this interface makes no sense, and it doesn't seem to be tested.
insertion_result.first = null_simplex();
}
}
}

if (++first == last) return insertion_result;
if (!has_children(simplex_one))
// TODO: have special code here, we know we are building the whole subtree from scratch.
Expand Down Expand Up @@ -1316,7 +1330,7 @@ class Simplex_tree {
* The complex does not need to be empty before calling this function. However, if a vertex is
* already present, its filtration value is not modified, unlike with other insertion functions. */
template <class VertexRange>
void insert_batch_vertices(VertexRange const& vertices, Filtration_value filt = 0) {
void insert_batch_vertices(VertexRange const& vertices, const Filtration_value& filt ={}) {
auto verts = vertices | boost::adaptors::transformed([&](auto v){
return Dit_value_t(v, Node(&root_, filt)); });
root_.members_.insert(boost::begin(verts), boost::end(verts));
Expand Down Expand Up @@ -1403,7 +1417,7 @@ class Simplex_tree {
static void intersection(std::vector<std::pair<Vertex_handle, Node> >& intersection,
Dictionary_it begin1, Dictionary_it end1,
Dictionary_it begin2, Dictionary_it end2,
Filtration_value filtration_) {
const Filtration_value& filtration_) {
if (begin1 == end1 || begin2 == end2)
return; // ----->>
while (true) {
Expand Down Expand Up @@ -1610,12 +1624,21 @@ class Simplex_tree {
if (dim == 0) return;
// Find the maximum filtration value in the border
Boundary_simplex_range&& boundary = boundary_simplex_range(sh);
Boundary_simplex_iterator max_border = std::max_element(std::begin(boundary), std::end(boundary),
[](Simplex_handle sh1, Simplex_handle sh2) {
return filtration(sh1) < filtration(sh2);
});
Filtration_value max_filt_border_value;
if constexpr (SimplexTreeOptions::is_multi_parameter) {
// in that case, we assume that Filtration_value has a `push_to` member to handle this.
Comment thread
VincentRouvreau marked this conversation as resolved.
Outdated
max_filt_border_value = Filtration_value(this->number_of_parameters_);
for (auto& face_sh : boundary) {
max_filt_border_value.push_to(
filtration(face_sh)); // pushes the value of max_filt_border_value to reach simplex' filtration
}
} else {
Boundary_simplex_iterator max_border =
std::max_element(std::begin(boundary), std::end(boundary),
[](Simplex_handle sh1, Simplex_handle sh2) { return filtration(sh1) < filtration(sh2); });
max_filt_border_value = filtration(*max_border);
}

Filtration_value max_filt_border_value = filtration(*max_border);
// Replacing if(f<max) with if(!(f>=max)) would mean that if f is NaN, we replace it with the max of the children.
// That seems more useful than keeping NaN.
if (!(sh->second.filtration() >= max_filt_border_value)) {
Expand Down Expand Up @@ -1650,7 +1673,7 @@ class Simplex_tree {
* than it was before. However, `upper_bound_dimension()` will return the old value, which remains a valid upper
* bound. If you care, you can call `dimension()` to recompute the exact dimension.
*/
bool prune_above_filtration(Filtration_value filtration) {
bool prune_above_filtration(const Filtration_value& filtration) {
if (std::numeric_limits<Filtration_value>::has_infinity && filtration == std::numeric_limits<Filtration_value>::infinity())
return false; // ---->>
bool modified = rec_prune_above_filtration(root(), filtration);
Expand All @@ -1660,7 +1683,7 @@ class Simplex_tree {
}

private:
bool rec_prune_above_filtration(Siblings* sib, Filtration_value filt) {
bool rec_prune_above_filtration(Siblings* sib, const Filtration_value& filt) {
auto&& list = sib->members();
auto last = std::remove_if(list.begin(), list.end(), [this,filt](Dit_value_t& simplex) {
if (simplex.second.filtration() <= filt) return false;
Expand Down Expand Up @@ -2070,7 +2093,7 @@ class Simplex_tree {
* @param[in] filt_value The new filtration value.
* @param[in] min_dim The minimal dimension. Default value is 0.
*/
void reset_filtration(Filtration_value filt_value, int min_dim = 0) {
void reset_filtration(const Filtration_value& filt_value, int min_dim = 0) {
rec_reset_filtration(&root_, filt_value, min_dim);
clear_filtration(); // Drop the cache.
}
Expand All @@ -2081,7 +2104,7 @@ class Simplex_tree {
* @param[in] filt_value The new filtration value.
* @param[in] min_depth The minimal depth.
*/
void rec_reset_filtration(Siblings * sib, Filtration_value filt_value, int min_depth) {
void rec_reset_filtration(Siblings * sib, const Filtration_value& filt_value, int min_depth) {
for (auto sh = sib->members().begin(); sh != sib->members().end(); ++sh) {
if (min_depth <= 0) {
sh->second.assign_filtration(filt_value);
Expand Down Expand Up @@ -2246,6 +2269,24 @@ class Simplex_tree {
/** \brief Upper bound on the dimension of the simplicial complex.*/
int dimension_;
bool dimension_to_be_lowered_ = false;

// MULTIPERS STUFF
public:
/**
* \brief Sets the number of parameters of the filtrations if SimplexTreeOptions::is_multi_parameter.
* */
void set_number_of_parameters(int num) { number_of_parameters_ = num; }
Comment thread
VincentRouvreau marked this conversation as resolved.
Outdated
/**
* \brief Gets the number of parameters of the filtrations if SimplexTreeOptions::is_multi_parameter.
* */
int get_number_of_parameters() const { return number_of_parameters_; }

inline static Filtration_value inf_ = std::numeric_limits<Filtration_value>::has_infinity() ?
std::numeric_limits<Filtration_value>::infinity()
: std::numeric_limits<Filtration_value>::max(); /**< Default infinite value. */

private:
int number_of_parameters_; /**< Number of parameters of the multi-filtrations when SimplexTreeOptions::is_multi_parameter.-*/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

number_of_parameters_ default value is 0. TBD, but wouldn't it be clearer from a user point of view to set it to 2 by default ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, why not, as the get number of parameters will always be 1 for non-multiparam simplextrees, this default value seems good.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OTOH, a "broken" value like 0 (or even -1) forces the user to be explicit (which can be seen as good or bad).

};

// Print a Simplex_tree in os.
Expand Down Expand Up @@ -2297,6 +2338,7 @@ struct Simplex_tree_options_full_featured {
static const bool contiguous_vertices = false;
static const bool link_nodes_by_label = false;
static const bool stable_simplex_handles = false;
static const bool is_multi_parameter = false;
};

/** Model of SimplexTreeOptions, faster than `Simplex_tree_options_full_featured` but note the unsafe
Expand All @@ -2314,6 +2356,7 @@ struct Simplex_tree_options_fast_persistence {
static const bool contiguous_vertices = true;
static const bool link_nodes_by_label = false;
static const bool stable_simplex_handles = false;
static const bool is_multi_parameter = false;
};

/** Model of SimplexTreeOptions, faster cofaces than `Simplex_tree_options_full_featured`, note the
Expand All @@ -2331,6 +2374,8 @@ struct Simplex_tree_options_fast_cofaces {
static const bool contiguous_vertices = false;
static const bool link_nodes_by_label = true;
static const bool stable_simplex_handles = false;
static const bool is_multi_parameter = false;

};

/** @}*/ // end addtogroup simplex_tree
Expand Down
Loading