From 305a57d3f1e2c389794e73965c96124d5d55fb4f Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 13 Nov 2017 16:39:28 +0000 Subject: User feedback : documentation shall explain the default homology_coeff_field is set to '11' in Simplex_tree Python bindings. git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2870 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 3db5b073fce8ca99271d20690e3559c3a0a6557d --- src/cython/cython/simplex_tree.pyx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 45487158..32b91028 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -312,7 +312,7 @@ cdef class SimplexTree: """This function returns the persistence of the simplicial complex. :param homology_coeff_field: The homology coefficient field. Must be a - prime number + prime number. Default value is 11. :type homology_coeff_field: int. :param min_persistence: The minimum persistence value to take into account (strictly greater than min_persistence). Default value is -- cgit v1.2.3 From 72263df69d75f6b987fae2ac22a9115f4f8b4279 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 13 Nov 2017 22:17:27 +0000 Subject: Thanks to code coverage, I fugured out some tests were not performed because of teir same name git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2872 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9c2158b7e0e77ad7ce8812bdfac312f3f7daf992 --- src/cython/test/test_cubical_complex.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/cython') diff --git a/src/cython/test/test_cubical_complex.py b/src/cython/test/test_cubical_complex.py index 9a365823..0e81554d 100755 --- a/src/cython/test/test_cubical_complex.py +++ b/src/cython/test/test_cubical_complex.py @@ -62,17 +62,17 @@ def test_dimension_or_perseus_file_constructor(): assert cub.__is_defined() == False assert cub.__is_persistence_defined() == False -def test_dimension_constructor(): +def test_dimension_simple_constructor(): cub = CubicalComplex(dimensions=[3, 3], top_dimensional_cells = [1,2,3,4,5,6,7,8,9]) assert cub.__is_defined() == True assert cub.__is_persistence_defined() == False - assert cub.persistence() == [(1, (0.0, 100.0)), (0, (0.0, float('inf')))] + assert cub.persistence() == [(0, (1.0, float('inf')))] assert cub.__is_persistence_defined() == True - assert cub.betti_numbers() == [1, 0] - assert cub.persistent_betti_numbers(0, 1000) == [0, 0] + assert cub.betti_numbers() == [1, 0, 0] + assert cub.persistent_betti_numbers(0, 1000) == [0, 0, 0] -def test_dimension_constructor(): +def test_dimension_file_constructor(): # Create test file test_file = open('CubicalOneSphere.txt', 'w') test_file.write('2\n3\n3\n0\n0\n0\n0\n100\n0\n0\n0\n0\n') -- cgit v1.2.3 From 0b10c9ffe09173787bef32ac7a5145aac6086435 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 17 Nov 2017 07:20:01 +0000 Subject: Homogenize shebang for Python scripts used as executables git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2903 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 904aff059b880e4e197fd81c46160d53b5794998 --- src/Nerve_GIC/example/KeplerMapperVisuFromTxtFile.py | 2 ++ src/cython/doc/python3-sphinx-build.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/Nerve_GIC/example/KeplerMapperVisuFromTxtFile.py b/src/Nerve_GIC/example/KeplerMapperVisuFromTxtFile.py index 406264ba..d2897774 100755 --- a/src/Nerve_GIC/example/KeplerMapperVisuFromTxtFile.py +++ b/src/Nerve_GIC/example/KeplerMapperVisuFromTxtFile.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import km import numpy as np from collections import defaultdict diff --git a/src/cython/doc/python3-sphinx-build.py b/src/cython/doc/python3-sphinx-build.py index 44b94169..84d158cf 100755 --- a/src/cython/doc/python3-sphinx-build.py +++ b/src/cython/doc/python3-sphinx-build.py @@ -1,4 +1,4 @@ -#!/usr/bin/python3 +#!/usr/bin/env python3 """ Emulate sphinx-build for python3 -- cgit v1.2.3 From e0c930251736ab31732787c4d94761e33f31ff4d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 20 Nov 2017 16:03:08 +0000 Subject: Add upper_bound_dimension and associated documentation for automatic dimension set. prune_above_filtration cythonization git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/set_dimension_mechanism_precision@2917 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 12af3c5c2d6012c43d80cc95e1ecc8a2c0df340e --- src/Simplex_tree/include/gudhi/Simplex_tree.h | 6 ++- src/cython/cython/simplex_tree.pyx | 73 ++++++++++++++++++++++++--- src/cython/test/test_simplex_tree.py | 24 +++++++++ 3 files changed, 94 insertions(+), 9 deletions(-) (limited to 'src/cython') diff --git a/src/Simplex_tree/include/gudhi/Simplex_tree.h b/src/Simplex_tree/include/gudhi/Simplex_tree.h index 7da767cb..eef710e1 100644 --- a/src/Simplex_tree/include/gudhi/Simplex_tree.h +++ b/src/Simplex_tree/include/gudhi/Simplex_tree.h @@ -761,8 +761,12 @@ class Simplex_tree { return &root_; } - /** Set a dimension for the simplicial complex. */ + /** \brief Set a dimension for the simplicial complex. + * \details This function must be used with caution because it disables dimension recomputation when required + * (this recomputation can be triggered by `remove_maximal_simplex()` or `prune_above_filtration()`). + */ void set_dimension(int dimension) { + dimension_to_be_lowered_ = false; dimension_ = dimension; } diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 32b91028..9204d7c6 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -42,6 +42,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": int num_simplices() void set_dimension(int dimension) int dimension() + int upper_bound_dimension() bint find_simplex(vector[int] simplex) bint insert_simplex_and_subfaces(vector[int] simplex, double filtration) @@ -50,8 +51,9 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": vector[pair[vector[int], double]] get_star(vector[int] simplex) vector[pair[vector[int], double]] get_cofaces(vector[int] simplex, int dimension) - void remove_maximal_simplex(vector[int] simplex) void expansion(int max_dim) + void remove_maximal_simplex(vector[int] simplex) + bool prune_above_filtration(double filtration) cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi": cdef cppclass Simplex_tree_persistence_interface "Gudhi::Persistent_cohomology_interface>": @@ -148,21 +150,36 @@ cdef class SimplexTree: :returns: the simplicial complex dimension. :rtype: int + + .. note:: + + This function is not constant time because it can recompute + dimension if required (can be triggered by + remove_maximal_simplex or prune_above_filtration methods). """ return self.thisptr.dimension() - def set_dimension(self, dimension): - """This function sets the dimension of the simplicial complex. + def upper_bound_dimension(self): + """This function returns a valid dimension upper bound of the + simplicial complex. - insert and remove_maximal_simplex functions do not update dimension - value of the `SimplexTree`. + :returns: an upper bound on the dimension of the simplicial complex. + :rtype: int + """ + return self.thisptr.upper_bound_dimension() - `AlphaComplex`, `RipsComplex`, `TangentialComplex` and `WitnessComplex` - automatically sets the correct dimension in their `create_simplex_tree` - functions. + def set_dimension(self, dimension): + """This function sets the dimension of the simplicial complex. :param dimension: The new dimension value. :type dimension: int. + + .. note:: + + This function must be used with caution because it disables + dimension recomputation when required + (this recomputation can be triggered by remove_maximal_simplex + or prune_above_filtration methods. """ self.thisptr.set_dimension(dimension) @@ -286,9 +303,49 @@ cdef class SimplexTree: :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int. + + .. note:: + + Be aware that removing is shifting data in a flat_map + (initialize_filtration to be done). + + .. note:: + + The dimension of the simplicial complex may be lower after calling + remove_maximal_simplex than it was before. However, + upper_bound_dimension method will return the old value, which + remains a valid upper bound. If you care, you can call dimension + to recompute the exact dimension. """ self.thisptr.remove_maximal_simplex(simplex) + def prune_above_filtration(self, filtration): + """Prune above filtration value given as parameter. + + :param filtration: Maximum threshold value. + :type filtration: float. + :returns: The filtration modification information. + :rtype: bint + + + .. note:: + + Some simplex tree functions require the filtration to be valid. + prune_above_filtration function is not launching + initialize_filtration but returns the filtration modification + information. If the complex has changed , please call + initialize_filtration to recompute it. + + .. note:: + + Note that the dimension of the simplicial complex may be lower + after calling prune_above_filtration 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 method to + recompute the exact dimension. + """ + return self.thisptr.prune_above_filtration(filtration) + def expansion(self, max_dim): """Expands the Simplex_tree containing only its one skeleton until dimension max_dim. diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py index 801d52b7..8af653d2 100755 --- a/src/cython/test/test_simplex_tree.py +++ b/src/cython/test/test_simplex_tree.py @@ -134,3 +134,27 @@ def test_expansion(): ([1, 2], 0.5), ([0, 1, 2], 0.5), ([1, 2, 3], 0.5), ([5], 0.6), ([6], 0.6), ([5, 6], 0.6), ([4], 0.7), ([2, 4], 0.7), ([0, 3], 0.8), ([0, 1, 3], 0.8), ([0, 2, 3], 0.8), ([0, 1, 2, 3], 0.8), ([4, 6], 0.9), ([3, 6], 1.0)] + +def test_automatic_dimension(): + st = SimplexTree() + assert st.__is_defined() == True + assert st.__is_persistence_defined() == False + + # insert test + assert st.insert([0,1,3], filtration=0.5) == True + assert st.insert([0,1,2], filtration=1.) == True + + assert st.num_vertices() == 4 + assert st.num_simplices() == 11 + + assert st.dimension() == 2 + assert st.upper_bound_dimension() == 2 + + assert st.prune_above_filtration(0.6) == True + assert st.dimension() == 2 + assert st.upper_bound_dimension() == 2 + + st.remove_maximal_simplex([0, 1, 3]) + assert st.upper_bound_dimension() == 2 + assert st.dimension() == 1 + assert st.upper_bound_dimension() == 1 -- cgit v1.2.3 From 3e1f686df11ec3e1ad02a18f12249621620ac969 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 20 Nov 2017 16:39:51 +0000 Subject: assign_filtration binding git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/set_dimension_mechanism_precision@2918 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 390839c0f172993f6117746d08c5a22c00778c5f --- src/cython/cython/simplex_tree.pyx | 12 ++++++++++++ src/cython/include/Simplex_tree_interface.h | 4 ++++ src/cython/test/test_simplex_tree.py | 3 +++ 3 files changed, 19 insertions(+) (limited to 'src/cython') diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 9204d7c6..ff12dd48 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -37,6 +37,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi": cdef cppclass Simplex_tree_interface_full_featured "Gudhi::Simplex_tree_interface": Simplex_tree() double simplex_filtration(vector[int] simplex) + void assign_simplex_filtration(vector[int] simplex, double filtration) void initialize_filtration() int num_vertices() int num_simplices() @@ -115,6 +116,17 @@ cdef class SimplexTree: """ return self.thisptr.simplex_filtration(simplex) + def assign_filtration(self, simplex, filtration): + """This function assigns the simplicial complex filtration value for a + given N-simplex. + + :param simplex: The N-simplex, represented by a list of vertex. + :type simplex: list of int. + :param filtration: The simplicial complex filtration value. + :type filtration: float + """ + self.thisptr.assign_simplex_filtration(simplex, filtration) + def initialize_filtration(self): """This function initializes and sorts the simplicial complex filtration vector. diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index 09e7e992..54a4f824 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -52,6 +52,10 @@ class Simplex_tree_interface : public Simplex_tree { return (Base::find(vh) != Base::null_simplex()); } + void assign_simplex_filtration(const Simplex& vh, Filtration_value filtration) { + Base::assign_filtration(Base::find(vh), filtration); + } + bool insert(const Simplex& simplex, Filtration_value filtration = 0) { Insertion_result result = Base::insert_simplex_and_subfaces(simplex, filtration); return (result.second); diff --git a/src/cython/test/test_simplex_tree.py b/src/cython/test/test_simplex_tree.py index 8af653d2..6dec5d94 100755 --- a/src/cython/test/test_simplex_tree.py +++ b/src/cython/test/test_simplex_tree.py @@ -154,6 +154,9 @@ def test_automatic_dimension(): assert st.dimension() == 2 assert st.upper_bound_dimension() == 2 + st.assign_filtration([0, 1, 3], 0.7) + assert st.filtration([0, 1, 3]) == 0.7 + st.remove_maximal_simplex([0, 1, 3]) assert st.upper_bound_dimension() == 2 assert st.dimension() == 1 -- cgit v1.2.3 From 854d67c38c35c076419e2261a9ca664334343050 Mon Sep 17 00:00:00 2001 From: glisse Date: Thu, 30 Nov 2017 23:34:17 +0000 Subject: python doc clarifications git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/misc-glisse@3001 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9dc859e34125fc163c02a32353879b59fff610a7 --- src/cython/cython/simplex_tree.pyx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/simplex_tree.pyx b/src/cython/cython/simplex_tree.pyx index 8a436619..0cb575d2 100644 --- a/src/cython/cython/simplex_tree.pyx +++ b/src/cython/cython/simplex_tree.pyx @@ -106,8 +106,8 @@ cdef class SimplexTree: return self.pcohptr != NULL def filtration(self, simplex): - """This function returns the simplicial complex filtration value for a - given N-simplex. + """This function returns the filtration value for a given N-simplex in + this simplicial complex, or +infinity if it is not in the complex. :param simplex: The N-simplex, represented by a list of vertex. :type simplex: list of int. @@ -222,14 +222,17 @@ cdef class SimplexTree: def insert(self, simplex, filtration=0.0): """This function inserts the given N-simplex and its subfaces with the - given filtration value (default value is '0.0'). + given filtration value (default value is '0.0'). If some of those + simplices are already present with a higher filtration value, their + filtration value is lowered. :param simplex: The N-simplex to insert, represented by a list of vertex. :type simplex: list of int. :param filtration: The filtration value of the simplex. :type filtration: float. - :returns: true if the simplex was found, false otherwise. + :returns: true if the simplex was not yet in the complex, false + otherwise (whatever its original filtration value). :rtype: bool """ cdef vector[int] csimplex -- cgit v1.2.3 From bc374be801a1162ef56d22923711230579380959 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 1 Dec 2017 17:05:44 +0000 Subject: Fix cubical periodic cythonization git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3004 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 664770dcae1726b94d4a486c376d1d2f744371eb --- src/cython/cython/periodic_cubical_complex.pyx | 14 ++++++++------ src/cython/include/Cubical_complex_interface.h | 6 ++++++ 2 files changed, 14 insertions(+), 6 deletions(-) (limited to 'src/cython') diff --git a/src/cython/cython/periodic_cubical_complex.pyx b/src/cython/cython/periodic_cubical_complex.pyx index 581c7b69..3025f125 100644 --- a/src/cython/cython/periodic_cubical_complex.pyx +++ b/src/cython/cython/periodic_cubical_complex.pyx @@ -33,7 +33,7 @@ __license__ = "GPL v3" cdef extern from "Cubical_complex_interface.h" namespace "Gudhi": cdef cppclass Periodic_cubical_complex_base_interface "Gudhi::Cubical_complex::Cubical_complex_interface>": - Periodic_cubical_complex_base_interface(vector[unsigned] dimensions, vector[double] top_dimensional_cells) + Periodic_cubical_complex_base_interface(vector[unsigned] dimensions, vector[double] top_dimensional_cells, vector[bool] periodic_dimensions) Periodic_cubical_complex_base_interface(string perseus_file) int num_simplices() int dimension() @@ -58,7 +58,7 @@ cdef class PeriodicCubicalComplex: # Fake constructor that does nothing but documenting the constructor def __init__(self, dimensions=None, top_dimensional_cells=None, - perseus_file=''): + periodic_dimensions=None, perseus_file=''): """PeriodicCubicalComplex constructor from dimensions and top_dimensional_cells or from a Perseus-style file name. @@ -66,6 +66,8 @@ cdef class PeriodicCubicalComplex: :type dimensions: list of int :param top_dimensional_cells: A list of cells filtration values. :type top_dimensional_cells: list of double + :param periodic_dimensions: A list of top dimensional cells periodicity value. + :type periodic_dimensions: list of boolean Or @@ -75,10 +77,10 @@ cdef class PeriodicCubicalComplex: # The real cython constructor def __cinit__(self, dimensions=None, top_dimensional_cells=None, - perseus_file=''): - if (dimensions is not None) and (top_dimensional_cells is not None) and (perseus_file is ''): - self.thisptr = new Periodic_cubical_complex_base_interface(dimensions, top_dimensional_cells) - elif (dimensions is None) and (top_dimensional_cells is None) and (perseus_file is not ''): + periodic_dimensions=None, perseus_file=''): + if (dimensions is not None) and (top_dimensional_cells is not None) and (periodic_dimensions is not None) and (perseus_file is ''): + self.thisptr = new Periodic_cubical_complex_base_interface(dimensions, top_dimensional_cells, periodic_dimensions) + elif (dimensions is None) and (top_dimensional_cells is None) and (periodic_dimensions is None) and (perseus_file is not ''): if os.path.isfile(perseus_file): self.thisptr = new Periodic_cubical_complex_base_interface(str.encode(perseus_file)) else: diff --git a/src/cython/include/Cubical_complex_interface.h b/src/cython/include/Cubical_complex_interface.h index 7c0148f1..fad92c2c 100644 --- a/src/cython/include/Cubical_complex_interface.h +++ b/src/cython/include/Cubical_complex_interface.h @@ -43,6 +43,12 @@ class Cubical_complex_interface : public Bitmap_cubical_complex(dimensions, top_dimensional_cells) { } + Cubical_complex_interface(const std::vector& dimensions, + const std::vector& top_dimensional_cells, + const std::vector& periodic_dimensions) + : Bitmap_cubical_complex(dimensions, top_dimensional_cells, periodic_dimensions) { + } + Cubical_complex_interface(const std::string& perseus_file) : Bitmap_cubical_complex(perseus_file.c_str()) { } -- cgit v1.2.3 From a5c0c05bbeb7d47d17cb277fe26e57683cc30ba4 Mon Sep 17 00:00:00 2001 From: glisse Date: Sat, 2 Dec 2017 13:41:06 +0000 Subject: remove dead variable max_dim git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/misc-glisse@3011 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: efdeef33160a5a0d8c033ff5b049ee6907d84671 --- src/cython/include/Tangential_complex_interface.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/cython/include/Tangential_complex_interface.h b/src/cython/include/Tangential_complex_interface.h index ecf014b3..0c3a510e 100644 --- a/src/cython/include/Tangential_complex_interface.h +++ b/src/cython/include/Tangential_complex_interface.h @@ -105,7 +105,7 @@ class Tangential_complex_interface { } void create_simplex_tree(Simplex_tree<>* simplex_tree) { - int max_dim = tangential_complex_->create_complex>(*simplex_tree); + tangential_complex_->create_complex>(*simplex_tree); simplex_tree->initialize_filtration(); } -- cgit v1.2.3 From 61f55efffe84f56b7de704c3a1fd6a19fd3d60a9 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 8 Dec 2017 11:07:09 +0000 Subject: File formats for iso cuboid and perseus in the Python version git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3057 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 6eb0a025d8549320e03727ce491563b2a941c82d --- src/common/doc/file_formats.h | 2 ++ src/cython/doc/cubical_complex_user.rst | 45 ++++++++++++--------------- src/cython/doc/fileformats.rst | 55 ++++++++++++++++++++++++++++++++- 3 files changed, 76 insertions(+), 26 deletions(-) (limited to 'src/cython') diff --git a/src/common/doc/file_formats.h b/src/common/doc/file_formats.h index d06b81f5..c60ed15a 100644 --- a/src/common/doc/file_formats.h +++ b/src/common/doc/file_formats.h @@ -117,6 +117,8 @@ namespace Gudhi { Indicate that we have imposed periodic boundary conditions in the direction x, but not in the direction y. + Other sample files can be found in the `data/bitmap` folder. + */ } // namespace Gudhi diff --git a/src/cython/doc/cubical_complex_user.rst b/src/cython/doc/cubical_complex_user.rst index 2bfac62a..34598f02 100644 --- a/src/cython/doc/cubical_complex_user.rst +++ b/src/cython/doc/cubical_complex_user.rst @@ -81,23 +81,7 @@ filtration to all cubes. There are a number of constructors that can be used to who want to use the code directly. They can be found in the :doc:`cubical_complex_ref`. Currently one input from a text file is used. It uses a format used already in `Perseus software `_ by Vidit Nanda. -Below we are providing a description of the format. The first line contains a number d begin the dimension of the -bitmap (2 in the example below). Next d lines are the numbers of top dimensional cubes in each dimensions (3 and 3 -in the example below). Next, in lexicographical order, the filtration of top dimensional cubes is given (1 4 6 8 -20 4 7 6 5 in the example below). - -.. figure:: - ../../doc/Bitmap_cubical_complex/exampleBitmap.png - :alt: Example of a input data. - :figclass: align-center - - Example of a input data. - -The input file for the following complex is: - -.. literalinclude:: ../../data/bitmap/cubicalcomplexdoc.txt - -.. centered:: ../../data/bitmap/cubicalcomplexdoc.txt +The file format is described here: :doc:`Perseus `. .. testcode:: @@ -124,15 +108,9 @@ Imposing periodic boundary conditions in the direction i, means that the left an :math:`\mathcal{K}` are considered the same. In particular, if for a bitmap :math:`\mathcal{K}` periodic boundary conditions are imposed in all directions, then complex :math:`\mathcal{K}` became n-dimensional torus. One can use various constructors from the file Bitmap_cubical_complex_periodic_boundary_conditions_base.h to construct cubical -complex with periodic boundary conditions. One can also use Perseus style input files. To indicate periodic boundary -conditions in a given direction, then number of top dimensional cells in this direction have to be multiplied by -1. -For instance: - -.. literalinclude:: ../../data/bitmap/periodiccubicalcomplexdoc.txt - -.. centered:: ../../data/bitmap/periodiccubicalcomplexdoc.txt +complex with periodic boundary conditions. -Indicate that we have imposed periodic boundary conditions in the direction x, but not in the direction y. +One can also use Perseus style input files (see :doc:`Perseus `) for the specific periodic case: .. testcode:: @@ -149,6 +127,23 @@ the program output is: Periodic cubical complex is of dimension 2 - 42 simplices. +Or it can be defined as follows: + +.. testcode:: + + from gudhi import PeriodicCubicalComplex as pcc + periodic_cc = pcc(dimensions=[3,3], + top_dimensional_cells= [0, 0, 0, 0, 1, 0, 0, 0, 0], + periodic_dimensions=[True, False]) + result_str = 'Periodic cubical complex is of dimension ' + repr(periodic_cc.dimension()) + ' - ' + \ + repr(periodic_cc.num_simplices()) + ' simplices.' + print(result_str) + +the program output is: + +.. testoutput:: + + Periodic cubical complex is of dimension 2 - 42 simplices. Examples. --------- diff --git a/src/cython/doc/fileformats.rst b/src/cython/doc/fileformats.rst index 156ef4e4..4f0b6f6d 100644 --- a/src/cython/doc/fileformats.rst +++ b/src/cython/doc/fileformats.rst @@ -23,7 +23,7 @@ Here is a simple sample file:: 3 34.2 34.974 4 3. inf -Other sample files can be found in the data/persistence_diagram folder. +Other sample files can be found in the `data/persistence_diagram` folder. Such files can be generated with :meth:`gudhi.SimplexTree.write_persistence_diagram`, read with @@ -31,3 +31,56 @@ Such files can be generated with :meth:`gudhi.read_persistence_intervals_in_dimension` and displayed with :meth:`gudhi.plot_persistence_barcode` or :meth:`gudhi.plot_persistence_diagram`. + +Iso-cuboid +********** + +Such a file describes an iso-oriented cuboid with diagonal opposite vertices +(min_x, min_y, min_z,...) and (max_x, max_y, max_z, ...). The format is:: + + min_x min_y [min_z ...] + max_x max_y [max_z ...] + +Here is a simple sample file in the 3D case:: + + -1. -1. -1. + 1. 1. 1. + + +Perseus +******* + +This file format is the format used by the +`Perseus software `_ by Vidit Nanda. +The first line contains a number d begin the dimension of the bitmap (2 in the +example below). Next d lines are the numbers of top dimensional cubes in each +dimensions (3 and 3 in the example below). Next, in lexicographical order, the +filtration of top dimensional cubes is given (1 4 6 8 20 4 7 6 5 in the example +below). + +.. figure:: + ../../doc/Bitmap_cubical_complex/exampleBitmap.png + :alt: Example of a input data. + :figclass: align-center + + Example of a input data. + +The input file for the following complex is: + +.. literalinclude:: ../../data/bitmap/cubicalcomplexdoc.txt + +.. centered:: ../../data/bitmap/cubicalcomplexdoc.txt + +To indicate periodic boundary conditions in a given direction, then number of +top dimensional cells in this direction have to be multiplied by -1. For +instance: + +.. literalinclude:: ../../data/bitmap/periodiccubicalcomplexdoc.txt + +.. centered:: ../../data/bitmap/periodiccubicalcomplexdoc.txt + + +Indicate that we have imposed periodic boundary conditions in the direction x, +but not in the direction y. + +Other sample files can be found in the `data/bitmap` folder. -- cgit v1.2.3 From 204e75f3fb1628fbe2be6f3fe4e91a858a8faab1 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Sat, 9 Dec 2017 13:44:25 +0000 Subject: Doc review: bad example link for euclidean strong witness Python example git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3063 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 16af7cb7d034eb3ca17ecd037f97e6d4d44e3d54 --- src/cython/doc/witness_complex_user.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cython') diff --git a/src/cython/doc/witness_complex_user.rst b/src/cython/doc/witness_complex_user.rst index 29413269..99be5185 100644 --- a/src/cython/doc/witness_complex_user.rst +++ b/src/cython/doc/witness_complex_user.rst @@ -121,7 +121,7 @@ Example2: Computing persistence using strong relaxed witness complex Here is an example of constructing a strong witness complex filtration and computing persistence on it: -* :download:`euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py <../example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py>` +* :download:`euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py <../example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py>` Bibliography ============ -- cgit v1.2.3 From dc8a8693966e8a6db45b0d9f142d3ff8e3da7c7f Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 19 Dec 2017 21:06:34 +0000 Subject: Boost minimal version is 1.48.0 (modification rollback) - if boost_version use static_vector (from Boost 1.54.0) git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3090 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 487d902c645793f2647191a0d8f9218184fa19de --- src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp | 9 +++++++++ src/cmake/modules/GUDHI_third_party_libraries.cmake | 2 +- src/common/doc/main_page.h | 2 +- src/cython/doc/installation.rst | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/cython') diff --git a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp index f4a14ae3..1070d17b 100644 --- a/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp +++ b/src/Alpha_complex/utilities/alpha_complex_3d_persistence.cpp @@ -20,9 +20,13 @@ * along with this program. If not, see . */ +#include #include #include + +#if BOOST_VERSION >= 105400 #include +#endif #include #include @@ -66,7 +70,12 @@ using Cell_handle = Alpha_shape_3::Cell_handle; using Facet = Alpha_shape_3::Facet; using Edge_3 = Alpha_shape_3::Edge; using Vertex_handle = Alpha_shape_3::Vertex_handle; + +#if BOOST_VERSION >= 105400 using Vertex_list = boost::container::static_vector; +#else +using Vertex_list = std::vector; +#endif // gudhi type definition using ST = Gudhi::Simplex_tree; diff --git a/src/cmake/modules/GUDHI_third_party_libraries.cmake b/src/cmake/modules/GUDHI_third_party_libraries.cmake index 7696496c..84545f18 100644 --- a/src/cmake/modules/GUDHI_third_party_libraries.cmake +++ b/src/cmake/modules/GUDHI_third_party_libraries.cmake @@ -1,6 +1,6 @@ # This files manage third party libraries required by GUDHI -find_package(Boost 1.56.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread) +find_package(Boost 1.48.0 REQUIRED COMPONENTS system filesystem unit_test_framework program_options thread) if(NOT Boost_FOUND) message(FATAL_ERROR "NOTICE: This program requires Boost and will not be compiled.") diff --git a/src/common/doc/main_page.h b/src/common/doc/main_page.h index 7ba8a4b7..148ee670 100644 --- a/src/common/doc/main_page.h +++ b/src/common/doc/main_page.h @@ -258,7 +258,7 @@ * Examples of GUDHI headers inclusion can be found in \ref demos. * * \section compiling Compiling - * The library uses c++11 and requires Boost with version 1.56.0 or + * The library uses c++11 and requires Boost with version 1.48.0 or * more recent. It is a multi-platform library and compiles on Linux, Mac OSX and Visual Studio 2015. * * \subsection demos Demos and examples diff --git a/src/cython/doc/installation.rst b/src/cython/doc/installation.rst index 2f689497..c182f176 100644 --- a/src/cython/doc/installation.rst +++ b/src/cython/doc/installation.rst @@ -5,7 +5,7 @@ Compiling ********* The library uses c++11 and requires `Boost `_ with -version 1.56.0 or more recent. It is a multi-platform library and compiles on +version 1.48.0 or more recent. It is a multi-platform library and compiles on Linux, Mac OSX and Visual Studio 2015. It also requires cmake to generate makefiles, and cython to compile the library. -- cgit v1.2.3 From e7e44c3779598108a8de3e773315e8a946f612b8 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 26 Jan 2018 15:31:11 +0000 Subject: Add doc Copyright for Python part git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3168 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: fccabadc27b805caecaab99517df80fab1113d73 --- src/cython/doc/_templates/layout.html | 2 +- src/cython/doc/conf.py | 4 ++-- src/cython/setup.py.in | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'src/cython') diff --git a/src/cython/doc/_templates/layout.html b/src/cython/doc/_templates/layout.html index 243f33c6..fd3e1cfd 100644 --- a/src/cython/doc/_templates/layout.html +++ b/src/cython/doc/_templates/layout.html @@ -255,7 +255,7 @@ {%- if hasdoc('copyright') %} {% trans path=pathto('copyright'), copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} {%- else %} - {% trans copyright=copyright|e %}© Copyright {{ copyright }}.{% endtrans %} + {% trans copyright=copyright|e %} {{ copyright }}.{% endtrans %} {%- endif %} {%- endif %} {%- if last_updated %} diff --git a/src/cython/doc/conf.py b/src/cython/doc/conf.py index 19a880d4..a13c9751 100755 --- a/src/cython/doc/conf.py +++ b/src/cython/doc/conf.py @@ -62,7 +62,7 @@ import gudhi # General information about the project. project = gudhi.__name__ -copyright = gudhi.__copyright__ +copyright = gudhi.__copyright__ + ' - ' + gudhi.__license__ # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -158,7 +158,7 @@ html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. diff --git a/src/cython/setup.py.in b/src/cython/setup.py.in index fefa36bb..c767e93d 100644 --- a/src/cython/setup.py.in +++ b/src/cython/setup.py.in @@ -23,7 +23,7 @@ from Cython.Build import cythonize along with this program. If not, see . """ -__author__ = "Vincent Rouvreau" +__author__ = "GUDHI Editorial Board" __copyright__ = "Copyright (C) 2016 INRIA" __license__ = "GPL v3" @@ -41,7 +41,7 @@ gudhi = Extension( setup( name = 'gudhi', - author='Vincent Rouvreau', + author='GUDHI Editorial Board', author_email='gudhi-contact@lists.gforge.inria.fr', version='@GUDHI_VERSION@', url='http://gudhi.gforge.inria.fr/', -- cgit v1.2.3 From e15408b4af5cba8966aa8773f6ee6884942c1d95 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Wed, 31 Jan 2018 08:18:58 +0000 Subject: Modify header (cpp and python) to fit with the new website sections git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3192 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 1dc2f0745020db4a27649c55dc1d01397b0a403c --- src/common/doc/header.html | 4 ++++ src/cython/doc/_templates/layout.html | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'src/cython') diff --git a/src/common/doc/header.html b/src/common/doc/header.html index 53b5c0a2..9c514381 100644 --- a/src/common/doc/header.html +++ b/src/common/doc/header.html @@ -56,6 +56,8 @@ $extrastylesheet
  • @@ -66,6 +68,8 @@ $extrastylesheet
  • C++ installation manual
  • Python documentation
  • Python installation manual
  • +
  • Utilities
  • +
  • Tutorial
  • diff --git a/src/cython/doc/_templates/layout.html b/src/cython/doc/_templates/layout.html index fd3e1cfd..8e4eba40 100644 --- a/src/cython/doc/_templates/layout.html +++ b/src/cython/doc/_templates/layout.html @@ -198,6 +198,8 @@
  • @@ -208,6 +210,8 @@
  • C++ installation manual
  • Python documentation
  • Python installation manual
  • +
  • Utilities
  • +
  • Tutorial
  • -- cgit v1.2.3 From 265484997185f3bf900744406206a2d64ca0a20d Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 2 Feb 2018 14:15:49 +0000 Subject: Fix after version release of Cover complex and Persistence representation installations Fix utils download link git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@3211 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 9596df8b0d0cdc3d8df79aa367a26b34a96d7f5e --- src/Nerve_GIC/example/CMakeLists.txt | 3 +++ src/Nerve_GIC/utilities/CMakeLists.txt | 4 ++++ src/Persistence_representations/example/CMakeLists.txt | 8 +++++--- src/Persistence_representations/utilities/CMakeLists.txt | 6 ++++++ .../utilities/persistence_intervals/CMakeLists.txt | 6 ++++++ src/common/doc/header.html | 4 ++-- src/cython/doc/_templates/layout.html | 4 ++-- 7 files changed, 28 insertions(+), 7 deletions(-) (limited to 'src/cython') diff --git a/src/Nerve_GIC/example/CMakeLists.txt b/src/Nerve_GIC/example/CMakeLists.txt index f2626927..542c6af4 100644 --- a/src/Nerve_GIC/example/CMakeLists.txt +++ b/src/Nerve_GIC/example/CMakeLists.txt @@ -23,4 +23,7 @@ if (NOT CGAL_VERSION VERSION_LESS 4.8.1) "lucky_cat.off" "lucky_cat_PCA1") + install(TARGETS CoordGIC DESTINATION bin) + install(TARGETS FuncGIC DESTINATION bin) + endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Nerve_GIC/utilities/CMakeLists.txt b/src/Nerve_GIC/utilities/CMakeLists.txt index 7762c8a0..7a838a8c 100644 --- a/src/Nerve_GIC/utilities/CMakeLists.txt +++ b/src/Nerve_GIC/utilities/CMakeLists.txt @@ -21,4 +21,8 @@ if (NOT CGAL_VERSION VERSION_LESS 4.8.1) add_test(NAME Nerve_GIC_utilities_VoronoiGIC COMMAND $ "human.off" "100") + install(TARGETS Nerve DESTINATION bin) + install(TARGETS VoronoiGIC DESTINATION bin) + install(FILES KeplerMapperVisuFromTxtFile.py km.py km.py.COPYRIGHT DESTINATION bin) + endif (NOT CGAL_VERSION VERSION_LESS 4.8.1) diff --git a/src/Persistence_representations/example/CMakeLists.txt b/src/Persistence_representations/example/CMakeLists.txt index eb3258f8..54d719ac 100644 --- a/src/Persistence_representations/example/CMakeLists.txt +++ b/src/Persistence_representations/example/CMakeLists.txt @@ -4,24 +4,26 @@ project(Persistence_representations_example) add_executable ( Persistence_representations_example_landscape_on_grid persistence_landscape_on_grid.cpp ) add_test(NAME Persistence_representations_example_landscape_on_grid COMMAND $) +install(TARGETS Persistence_representations_example_landscape_on_grid DESTINATION bin) add_executable ( Persistence_representations_example_landscape persistence_landscape.cpp ) add_test(NAME Persistence_representations_example_landscape COMMAND $) +install(TARGETS Persistence_representations_example_landscape DESTINATION bin) add_executable ( Persistence_representations_example_intervals persistence_intervals.cpp ) add_test(NAME Persistence_representations_example_intervals COMMAND $ "${CMAKE_SOURCE_DIR}/data/persistence_diagram/first.pers") +install(TARGETS Persistence_representations_example_intervals DESTINATION bin) add_executable ( Persistence_representations_example_vectors persistence_vectors.cpp ) add_test(NAME Persistence_representations_example_vectors COMMAND $) +install(TARGETS Persistence_representations_example_vectors DESTINATION bin) add_executable ( Persistence_representations_example_heat_maps persistence_heat_maps.cpp ) add_test(NAME Persistence_representations_example_heat_maps COMMAND $) - - - +install(TARGETS Persistence_representations_example_heat_maps DESTINATION bin) diff --git a/src/Persistence_representations/utilities/CMakeLists.txt b/src/Persistence_representations/utilities/CMakeLists.txt index 137eb0c1..fc51b1d6 100644 --- a/src/Persistence_representations/utilities/CMakeLists.txt +++ b/src/Persistence_representations/utilities/CMakeLists.txt @@ -10,6 +10,8 @@ function(add_persistence_representation_creation_utility creation_utility) add_test(NAME Persistence_representation_utilities_${creation_utility} COMMAND $ ${ARGN} "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" "${CMAKE_CURRENT_BINARY_DIR}/../second.pers") + + install(TARGETS ${creation_utility} DESTINATION bin) endfunction(add_persistence_representation_creation_utility) function(add_persistence_representation_plot_utility plot_utility tool_extension) @@ -26,6 +28,8 @@ function(add_persistence_representation_plot_utility plot_utility tool_extension #add_test(NAME Persistence_representation_utilities_${plot_utility}_second_gnuplot COMMAND ${GNUPLOT_PATH} # "-e" "load '${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}_GnuplotScript'") endif() + + install(TARGETS ${plot_utility} DESTINATION bin) endfunction(add_persistence_representation_plot_utility) function(add_persistence_representation_function_utility function_utility tool_extension) @@ -44,6 +48,8 @@ function(add_persistence_representation_function_utility function_utility tool_e "${CMAKE_CURRENT_BINARY_DIR}/../first.pers${tool_extension}" "${CMAKE_CURRENT_BINARY_DIR}/../second.pers${tool_extension}") endif() + + install(TARGETS ${function_utility} DESTINATION bin) endfunction(add_persistence_representation_function_utility) add_subdirectory(persistence_heat_maps) diff --git a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt index 897e12a3..875ff45e 100644 --- a/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt +++ b/src/Persistence_representations/utilities/persistence_intervals/CMakeLists.txt @@ -7,6 +7,8 @@ add_executable ( plot_histogram_of_intervals_lengths plot_histogram_of_intervals add_test(NAME plot_histogram_of_intervals_lengths COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" "-1") +install(TARGETS plot_histogram_of_intervals_lengths DESTINATION bin) + add_persistence_representation_plot_utility(plot_persistence_intervals "") add_persistence_representation_plot_utility(plot_persistence_Betti_numbers "") @@ -18,6 +20,8 @@ add_test(NAME Persistence_representation_utilities_compute_number_of_dominant_in COMMAND $ "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" "-1" "2") +install(TARGETS compute_number_of_dominant_intervals DESTINATION bin) + if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) add_executable ( compute_bottleneck_distance compute_bottleneck_distance.cpp ) @@ -29,4 +33,6 @@ if (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) "-1" "${CMAKE_CURRENT_BINARY_DIR}/../first.pers" "${CMAKE_CURRENT_BINARY_DIR}/../second.pers") + + install(TARGETS compute_bottleneck_distance DESTINATION bin) endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.8.1) diff --git a/src/common/doc/header.html b/src/common/doc/header.html index 9c514381..d69b28fa 100644 --- a/src/common/doc/header.html +++ b/src/common/doc/header.html @@ -56,8 +56,8 @@ $extrastylesheet
  • diff --git a/src/cython/doc/_templates/layout.html b/src/cython/doc/_templates/layout.html index 8e4eba40..c9356116 100644 --- a/src/cython/doc/_templates/layout.html +++ b/src/cython/doc/_templates/layout.html @@ -198,8 +198,8 @@
  • -- cgit v1.2.3