summaryrefslogtreecommitdiff
path: root/cython
diff options
context:
space:
mode:
authorGard Spreemann <gspreemann@gmail.com>2018-06-14 20:39:01 +0200
committerGard Spreemann <gspreemann@gmail.com>2018-06-14 20:39:01 +0200
commitc524232f734de875d69e2f190f01a6c976024368 (patch)
treed8bba27646c367cb2b7c718354dd036892bcd629 /cython
parent9899ae167f281d10b1684dfcd02c6838c5bf28df (diff)
GUDHI 2.2.0 as released by upstream in a tarball.upstream/2.2.0
Diffstat (limited to 'cython')
-rw-r--r--cython/CMakeLists.txt41
-rw-r--r--cython/cython/alpha_complex.pyx4
-rw-r--r--cython/cython/bottleneck_distance.pyx4
-rw-r--r--cython/cython/cubical_complex.pyx29
-rw-r--r--cython/cython/euclidean_strong_witness_complex.pyx4
-rw-r--r--cython/cython/euclidean_witness_complex.pyx4
-rw-r--r--cython/cython/off_reader.pyx5
-rw-r--r--cython/cython/periodic_cubical_complex.pyx29
-rwxr-xr-xcython/cython/persistence_graphical_tools.py107
-rw-r--r--cython/cython/reader_utils.pyx4
-rw-r--r--cython/cython/rips_complex.pyx39
-rw-r--r--cython/cython/simplex_tree.pyx45
-rw-r--r--cython/cython/strong_witness_complex.pyx4
-rw-r--r--cython/cython/subsampling.pyx4
-rw-r--r--cython/cython/tangential_complex.pyx19
-rw-r--r--cython/cython/witness_complex.pyx4
-rw-r--r--cython/doc/_templates/layout.html122
-rw-r--r--cython/doc/alpha_complex_ref.rst4
-rw-r--r--cython/doc/alpha_complex_sum.inc (renamed from cython/doc/alpha_complex_sum.rst)0
-rw-r--r--cython/doc/alpha_complex_user.rst12
-rw-r--r--cython/doc/bottleneck_distance_sum.inc (renamed from cython/doc/bottleneck_distance_sum.rst)0
-rw-r--r--cython/doc/bottleneck_distance_user.rst6
-rw-r--r--cython/doc/citation.rst4
-rwxr-xr-xcython/doc/conf.py3
-rw-r--r--cython/doc/cubical_complex_ref.rst4
-rw-r--r--cython/doc/cubical_complex_sum.inc (renamed from cython/doc/cubical_complex_sum.rst)0
-rw-r--r--cython/doc/cubical_complex_user.rst7
-rw-r--r--cython/doc/euclidean_strong_witness_complex_ref.rst4
-rw-r--r--cython/doc/euclidean_witness_complex_ref.rst4
-rw-r--r--cython/doc/examples.rst4
-rw-r--r--cython/doc/fileformats.rst4
-rw-r--r--cython/doc/index.rst18
-rw-r--r--cython/doc/installation.rst15
-rw-r--r--cython/doc/periodic_cubical_complex_ref.rst4
-rw-r--r--cython/doc/persistence_graphical_tools_ref.rst5
-rw-r--r--cython/doc/persistence_graphical_tools_sum.inc (renamed from cython/doc/persistence_graphical_tools_sum.rst)0
-rw-r--r--cython/doc/persistence_graphical_tools_user.rst71
-rw-r--r--cython/doc/persistent_cohomology_sum.inc (renamed from cython/doc/persistent_cohomology_sum.rst)0
-rw-r--r--cython/doc/persistent_cohomology_user.rst4
-rwxr-xr-xcython/doc/pyplots/barcode_persistence.py7
-rwxr-xr-xcython/doc/pyplots/diagram_persistence.py8
-rwxr-xr-xcython/doc/pyplots/show_palette_values.py3
-rw-r--r--cython/doc/reader_utils_ref.rst4
-rw-r--r--cython/doc/rips_complex_ref.rst4
-rw-r--r--cython/doc/rips_complex_sum.inc (renamed from cython/doc/rips_complex_sum.rst)0
-rw-r--r--cython/doc/rips_complex_user.rst84
-rw-r--r--cython/doc/simplex_tree_ref.rst4
-rw-r--r--cython/doc/simplex_tree_sum.inc (renamed from cython/doc/simplex_tree_sum.rst)0
-rw-r--r--cython/doc/simplex_tree_user.rst6
-rw-r--r--cython/doc/strong_witness_complex_ref.rst4
-rw-r--r--cython/doc/tangential_complex_ref.rst4
-rw-r--r--cython/doc/tangential_complex_sum.inc (renamed from cython/doc/tangential_complex_sum.rst)0
-rw-r--r--cython/doc/tangential_complex_user.rst13
-rw-r--r--cython/doc/todos.rst4
-rw-r--r--cython/doc/witness_complex_ref.rst4
-rw-r--r--cython/doc/witness_complex_sum.inc (renamed from cython/doc/witness_complex_sum.rst)0
-rw-r--r--cython/doc/witness_complex_user.rst6
-rwxr-xr-xcython/example/alpha_complex_diagram_persistence_from_off_file_example.py8
-rwxr-xr-xcython/example/alpha_complex_from_points_example.py4
-rwxr-xr-xcython/example/alpha_rips_persistence_bottleneck_distance.py9
-rwxr-xr-xcython/example/bottleneck_basic_example.py6
-rwxr-xr-xcython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py8
-rwxr-xr-xcython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py8
-rwxr-xr-xcython/example/gudhi_graphical_tools_example.py11
-rwxr-xr-xcython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py4
-rwxr-xr-xcython/example/random_cubical_complex_persistence_example.py4
-rwxr-xr-xcython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py84
-rwxr-xr-xcython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py15
-rwxr-xr-xcython/example/rips_complex_diagram_persistence_from_off_file_example.py11
-rwxr-xr-xcython/example/rips_complex_from_points_example.py4
-rwxr-xr-xcython/example/rips_persistence_diagram.py4
-rwxr-xr-xcython/example/simplex_tree_example.py4
-rwxr-xr-xcython/example/tangential_complex_plain_homology_from_off_file_example.py13
-rwxr-xr-xcython/example/witness_complex_from_nearest_landmark_table.py4
-rw-r--r--cython/gudhi.pyx.in4
-rw-r--r--cython/include/Alpha_complex_interface.h2
-rw-r--r--cython/include/Bottleneck_distance_interface.h2
-rw-r--r--cython/include/Cubical_complex_interface.h2
-rw-r--r--cython/include/Euclidean_strong_witness_complex_interface.h2
-rw-r--r--cython/include/Euclidean_witness_complex_interface.h2
-rw-r--r--cython/include/Off_reader_interface.h2
-rw-r--r--cython/include/Persistent_cohomology_interface.h28
-rw-r--r--cython/include/Reader_utils_interface.h2
-rw-r--r--cython/include/Rips_complex_interface.h19
-rw-r--r--cython/include/Simplex_tree_interface.h2
-rw-r--r--cython/include/Strong_witness_complex_interface.h2
-rw-r--r--cython/include/Subsampling_interface.h2
-rw-r--r--cython/include/Tangential_complex_interface.h15
-rw-r--r--cython/include/Witness_complex_interface.h2
-rw-r--r--cython/setup.py.in9
-rwxr-xr-xcython/test/test_alpha_complex.py4
-rwxr-xr-xcython/test/test_bottleneck_distance.py4
-rwxr-xr-xcython/test/test_cubical_complex.py15
-rwxr-xr-xcython/test/test_euclidean_witness_complex.py4
-rwxr-xr-xcython/test/test_reader_utils.py4
-rwxr-xr-xcython/test/test_rips_complex.py4
-rwxr-xr-xcython/test/test_simplex_tree.py48
-rwxr-xr-xcython/test/test_subsampling.py4
-rwxr-xr-xcython/test/test_tangential_complex.py6
-rwxr-xr-xcython/test/test_witness_complex.py4
100 files changed, 742 insertions, 449 deletions
diff --git a/cython/CMakeLists.txt b/cython/CMakeLists.txt
index afca9d60..17d440ee 100644
--- a/cython/CMakeLists.txt
+++ b/cython/CMakeLists.txt
@@ -1,4 +1,3 @@
-cmake_minimum_required(VERSION 2.8)
project(Cython)
function( add_gudhi_cython_lib THE_LIB )
@@ -32,35 +31,6 @@ if(CYTHON_FOUND)
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ")
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_SYSTEM_NO_DEPRECATED', ")
- # This is because of https://github.com/CGAL/cgal/blob/master/Installation/include/CGAL/tss.h
- # CGAL is using boost thread if thread_local is not ready (requires XCode 8 for Mac).
- # The test in https://github.com/CGAL/cgal/blob/master/Installation/include/CGAL/config.h
- # #if __has_feature(cxx_thread_local) || \
- # ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
- # ( _MSC_VER >= 1900 )
- # #define CGAL_CAN_USE_CXX11_THREAD_LOCAL
- # #endif
- set(CGAL_CAN_USE_CXX11_THREAD_LOCAL "
- int main() {
- #ifndef __has_feature
- #define __has_feature(x) 0 // Compatibility with non-clang compilers.
- #endif
- #if __has_feature(cxx_thread_local) || \
- ( (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 && __cplusplus >= 201103L ) || \
- ( _MSC_VER >= 1900 )
- bool has_feature_thread_local = true;
- #else
- // Explicit error of compilation for CMake test purpose - has_feature_thread_local is not defined
- #endif
- bool result = has_feature_thread_local;
- } ")
- check_cxx_source_compiles("${CGAL_CAN_USE_CXX11_THREAD_LOCAL}" CGAL_CAN_USE_CXX11_THREAD_LOCAL_RESULT)
-
- if (NOT CGAL_CAN_USE_CXX11_THREAD_LOCAL_RESULT)
- add_gudhi_cython_lib(${Boost_THREAD_LIBRARY})
- set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ")
- endif()
-
# Gudhi and CGAL compilation option
if(MSVC)
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'/fp:strict', ")
@@ -99,11 +69,16 @@ if(CYTHON_FOUND)
endif (NOT CGAL_WITH_EIGEN3_VERSION VERSION_LESS 4.6.0)
if(CGAL_FOUND)
+ can_cgal_use_cxx11_thread_local()
+ if (NOT CGAL_CAN_USE_CXX11_THREAD_LOCAL_RESULT)
+ add_gudhi_cython_lib(${Boost_THREAD_LIBRARY})
+ set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ")
+ endif()
# Add CGAL compilation args
if(CGAL_HEADER_ONLY)
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ")
else(CGAL_HEADER_ONLY)
- add_gudhi_cython_lib(${CGAL_LIBRARIES})
+ add_gudhi_cython_lib(${CGAL_LIBRARY})
set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ")
# If CGAL is not header only, CGAL library may link with boost system,
add_gudhi_cython_lib(${Boost_SYSTEM_LIBRARY})
@@ -135,7 +110,7 @@ if(CYTHON_FOUND)
endforeach()
set(GUDHI_CYTHON_INCLUDE_DIRS "${GUDHI_CYTHON_INCLUDE_DIRS}'${CMAKE_SOURCE_DIR}/${GUDHI_CYTHON_PATH}/include', ")
- if (TBB_FOUND)
+ if (TBB_FOUND AND WITH_GUDHI_USE_TBB)
set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DGUDHI_USE_TBB', ")
add_gudhi_cython_lib(${TBB_RELEASE_LIBRARY})
add_gudhi_cython_lib(${TBB_MALLOC_RELEASE_LIBRARY})
@@ -181,7 +156,7 @@ if(CYTHON_FOUND)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_COMMAND} -E env "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}"
${PYTHON_EXECUTABLE} "${CMAKE_CURRENT_SOURCE_DIR}/example/tangential_complex_plain_homology_from_off_file_example.py"
- --no-diagram -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off)
+ --no-diagram -i 2 -f ${CMAKE_SOURCE_DIR}/data/points/tore3D_300.off)
add_gudhi_py_test(test_tangential_complex)
diff --git a/cython/cython/alpha_complex.pyx b/cython/cython/alpha_complex.pyx
index a0e8f9b7..4f772e31 100644
--- a/cython/cython/alpha_complex.pyx
+++ b/cython/cython/alpha_complex.pyx
@@ -11,7 +11,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Alpha_complex_interface.h" namespace "Gudhi":
diff --git a/cython/cython/bottleneck_distance.pyx b/cython/cython/bottleneck_distance.pyx
index 9fb377ff..76ef81f4 100644
--- a/cython/cython/bottleneck_distance.pyx
+++ b/cython/cython/bottleneck_distance.pyx
@@ -9,7 +9,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Bottleneck_distance_interface.h" namespace "Gudhi::persistence_diagram":
diff --git a/cython/cython/cubical_complex.pyx b/cython/cython/cubical_complex.pyx
index ffc85130..e94cd539 100644
--- a/cython/cython/cubical_complex.pyx
+++ b/cython/cython/cubical_complex.pyx
@@ -11,7 +11,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Cubical_complex_interface.h" namespace "Gudhi":
@@ -104,22 +104,21 @@ cdef class CubicalComplex:
return self.pcohptr != NULL
def num_simplices(self):
- """This function returns the number of simplices of the simplicial
- complex.
+ """This function returns the number of all cubes in the complex.
- :returns: int -- the simplicial complex number of simplices.
+ :returns: int -- the number of all cubes in the complex.
"""
return self.thisptr.num_simplices()
def dimension(self):
- """This function returns the dimension of the simplicial complex.
+ """This function returns the dimension of the complex.
- :returns: int -- the simplicial complex dimension.
+ :returns: int -- the complex dimension.
"""
return self.thisptr.dimension()
def persistence(self, homology_coeff_field=11, min_persistence=0):
- """This function returns the persistence of the simplicial complex.
+ """This function returns the persistence of the complex.
:param homology_coeff_field: The homology coefficient field. Must be a
prime number
@@ -130,7 +129,7 @@ cdef class CubicalComplex:
Sets min_persistence to -1.0 to see all values.
:type min_persistence: float.
:returns: list of pairs(dimension, pair(birth, death)) -- the
- persistence of the simplicial complex.
+ persistence of the complex.
"""
if self.pcohptr != NULL:
del self.pcohptr
@@ -142,12 +141,15 @@ cdef class CubicalComplex:
return persistence_result
def betti_numbers(self):
- """This function returns the Betti numbers of the simplicial complex.
+ """This function returns the Betti numbers of the complex.
:returns: list of int -- The Betti numbers ([B0, B1, ..., Bn]).
:note: betti_numbers function requires persistence function to be
launched first.
+
+ :note: betti_numbers function always returns [1, 0, 0, ...] as infinity
+ filtration cubes are not removed from the complex.
"""
cdef vector[int] bn_result
if self.pcohptr != NULL:
@@ -155,8 +157,7 @@ cdef class CubicalComplex:
return bn_result
def persistent_betti_numbers(self, from_value, to_value):
- """This function returns the persistent Betti numbers of the
- simplicial complex.
+ """This function returns the persistent Betti numbers of the complex.
:param from_value: The persistence birth limit to be added in the
numbers (persistent birth <= from_value).
@@ -177,8 +178,8 @@ cdef class CubicalComplex:
return pbn_result
def persistence_intervals_in_dimension(self, dimension):
- """This function returns the persistence intervals of the simplicial
- complex in a specific dimension.
+ """This function returns the persistence intervals of the complex in a
+ specific dimension.
:param dimension: The specific dimension.
:type from_value: int.
diff --git a/cython/cython/euclidean_strong_witness_complex.pyx b/cython/cython/euclidean_strong_witness_complex.pyx
index c1523892..62b7cf71 100644
--- a/cython/cython/euclidean_strong_witness_complex.pyx
+++ b/cython/cython/euclidean_strong_witness_complex.pyx
@@ -8,7 +8,7 @@ from libcpp.utility cimport pair
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ from libcpp.utility cimport pair
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Euclidean_strong_witness_complex_interface.h" namespace "Gudhi":
diff --git a/cython/cython/euclidean_witness_complex.pyx b/cython/cython/euclidean_witness_complex.pyx
index 7c443b6b..c10ca73d 100644
--- a/cython/cython/euclidean_witness_complex.pyx
+++ b/cython/cython/euclidean_witness_complex.pyx
@@ -8,7 +8,7 @@ from libcpp.utility cimport pair
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ from libcpp.utility cimport pair
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Euclidean_witness_complex_interface.h" namespace "Gudhi":
diff --git a/cython/cython/off_reader.pyx b/cython/cython/off_reader.pyx
index b6e107ef..b939013f 100644
--- a/cython/cython/off_reader.pyx
+++ b/cython/cython/off_reader.pyx
@@ -9,7 +9,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Off_reader_interface.h" namespace "Gudhi":
@@ -46,4 +46,5 @@ def read_off(off_file=''):
return read_points_from_OFF_file(str.encode(off_file))
else:
print("file " + off_file + " not found.")
+ return []
diff --git a/cython/cython/periodic_cubical_complex.pyx b/cython/cython/periodic_cubical_complex.pyx
index 3025f125..e626950b 100644
--- a/cython/cython/periodic_cubical_complex.pyx
+++ b/cython/cython/periodic_cubical_complex.pyx
@@ -11,7 +11,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Cubical_complex_interface.h" namespace "Gudhi":
@@ -106,22 +106,21 @@ cdef class PeriodicCubicalComplex:
return self.pcohptr != NULL
def num_simplices(self):
- """This function returns the number of simplices of the simplicial
- complex.
+ """This function returns the number of all cubes in the complex.
- :returns: int -- the simplicial complex number of simplices.
+ :returns: int -- the number of all cubes in the complex.
"""
return self.thisptr.num_simplices()
def dimension(self):
- """This function returns the dimension of the simplicial complex.
+ """This function returns the dimension of the complex.
- :returns: int -- the simplicial complex dimension.
+ :returns: int -- the complex dimension.
"""
return self.thisptr.dimension()
def persistence(self, homology_coeff_field=11, min_persistence=0):
- """This function returns the persistence of the simplicial complex.
+ """This function returns the persistence of the complex.
:param homology_coeff_field: The homology coefficient field. Must be a
prime number
@@ -132,7 +131,7 @@ cdef class PeriodicCubicalComplex:
Sets min_persistence to -1.0 to see all values.
:type min_persistence: float.
:returns: list of pairs(dimension, pair(birth, death)) -- the
- persistence of the simplicial complex.
+ persistence of the complex.
"""
if self.pcohptr != NULL:
del self.pcohptr
@@ -144,12 +143,15 @@ cdef class PeriodicCubicalComplex:
return persistence_result
def betti_numbers(self):
- """This function returns the Betti numbers of the simplicial complex.
+ """This function returns the Betti numbers of the complex.
:returns: list of int -- The Betti numbers ([B0, B1, ..., Bn]).
:note: betti_numbers function requires persistence function to be
launched first.
+
+ :note: betti_numbers function always returns [1, 0, 0, ...] as infinity
+ filtration cubes are not removed from the complex.
"""
cdef vector[int] bn_result
if self.pcohptr != NULL:
@@ -157,8 +159,7 @@ cdef class PeriodicCubicalComplex:
return bn_result
def persistent_betti_numbers(self, from_value, to_value):
- """This function returns the persistent Betti numbers of the
- simplicial complex.
+ """This function returns the persistent Betti numbers of the complex.
:param from_value: The persistence birth limit to be added in the
numbers (persistent birth <= from_value).
@@ -179,8 +180,8 @@ cdef class PeriodicCubicalComplex:
return pbn_result
def persistence_intervals_in_dimension(self, dimension):
- """This function returns the persistence intervals of the simplicial
- complex in a specific dimension.
+ """This function returns the persistence intervals of the complex in a
+ specific dimension.
:param dimension: The specific dimension.
:type from_value: int.
diff --git a/cython/cython/persistence_graphical_tools.py b/cython/cython/persistence_graphical_tools.py
index fb837e29..216ab8d6 100755
--- a/cython/cython/persistence_graphical_tools.py
+++ b/cython/cython/persistence_graphical_tools.py
@@ -1,4 +1,5 @@
import matplotlib.pyplot as plt
+import matplotlib.patches as mpatches
import numpy as np
import os
@@ -8,7 +9,7 @@ import os
Author(s): Vincent Rouvreau, Bertrand Michel
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,16 +26,16 @@ import os
"""
__author__ = "Vincent Rouvreau, Bertrand Michel"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
-def __min_birth_max_death(persistence, band_boot=0.):
+def __min_birth_max_death(persistence, band=0.):
"""This function returns (min_birth, max_death) from the persistence.
:param persistence: The persistence to plot.
:type persistence: list of tuples(dimension, tuple(birth, death)).
- :param band_boot: bootstrap band
- :type band_boot: float.
+ :param band: band
+ :type band: float.
:returns: (float, float) -- (min_birth, max_death).
"""
# Look for minimum birth date and maximum death date for plot optimisation
@@ -48,8 +49,8 @@ def __min_birth_max_death(persistence, band_boot=0.):
max_death = float(interval[1][0])
if float(interval[1][0]) < min_birth:
min_birth = float(interval[1][0])
- if band_boot > 0.:
- max_death += band_boot
+ if band > 0.:
+ max_death += band
return (min_birth, max_death)
"""
@@ -59,37 +60,27 @@ palette = ['#ff0000', '#00ff00', '#0000ff', '#00ffff', '#ff00ff', '#ffff00',
'#000000', '#880000', '#008800', '#000088', '#888800', '#880088',
'#008888']
-def show_palette_values(alpha=0.6):
- """This function shows palette color values in function of the dimension.
+def plot_persistence_barcode(persistence=[], persistence_file='', alpha=0.6,
+ max_barcodes=1000, inf_delta=0.1, legend=False):
+ """This function plots the persistence bar code from persistence values list
+ or from a :doc:`persistence file <fileformats>`.
- :param alpha: alpha value in [0.0, 1.0] for horizontal bars (default is 0.6).
- :type alpha: float.
- :returns: plot the dimension palette values.
- """
- colors = []
- for color in palette:
- colors.append(color)
-
- y_pos = np.arange(len(palette))
-
- plt.barh(y_pos, y_pos + 1, align='center', alpha=alpha, color=colors)
- plt.ylabel('Dimension')
- plt.title('Dimension palette values')
- return plt
-
-def plot_persistence_barcode(persistence=[], persistence_file='', alpha=0.6, max_barcodes=0):
- """This function plots the persistence bar code.
-
- :param persistence: The persistence to plot.
+ :param persistence: Persistence values list.
:type persistence: list of tuples(dimension, tuple(birth, death)).
- :param persistence_file: A persistence file style name (reset persistence if both are set).
+ :param persistence_file: A :doc:`persistence file <fileformats>` style name
+ (reset persistence if both are set).
:type persistence_file: string
- :param alpha: alpha value in [0.0, 1.0] for horizontal bars (default is 0.6).
+ :param alpha: barcode transparency value (0.0 transparent through 1.0 opaque - default is 0.6).
:type alpha: float.
- :param max_barcodes: number of maximal barcodes to be displayed
+ :param max_barcodes: number of maximal barcodes to be displayed.
+ Set it to 0 to see all, Default value is 1000.
(persistence will be sorted by life time if max_barcodes is set)
:type max_barcodes: int.
- :returns: plot -- An horizontal bar plot of persistence.
+ :param inf_delta: Infinity is placed at ((max_death - min_birth) x inf_delta).
+ A reasonable value is between 0.05 and 0.5 - default is 0.1.
+ :type inf_delta: float.
+ :returns: A matplotlib object containing horizontal bar plot of persistence
+ (launch `show()` method on it to display it).
"""
if persistence_file is not '':
if os.path.isfile(persistence_file):
@@ -107,9 +98,11 @@ def plot_persistence_barcode(persistence=[], persistence_file='', alpha=0.6, max
# Sort by life time, then takes only the max_plots elements
persistence = sorted(persistence, key=lambda life_time: life_time[1][1]-life_time[1][0], reverse=True)[:max_barcodes]
+ persistence = sorted(persistence, key=lambda birth: birth[1][0])
+
(min_birth, max_death) = __min_birth_max_death(persistence)
ind = 0
- delta = ((max_death - min_birth) / 10.0)
+ delta = ((max_death - min_birth) * inf_delta)
# Replace infinity values with max_death + delta for bar code to be more
# readable
infinity = max_death + delta
@@ -120,33 +113,49 @@ def plot_persistence_barcode(persistence=[], persistence_file='', alpha=0.6, max
# Finite death case
plt.barh(ind, (interval[1][1] - interval[1][0]), height=0.8,
left = interval[1][0], alpha=alpha,
- color = palette[interval[0]])
+ color = palette[interval[0]],
+ linewidth=0)
else:
# Infinite death case for diagram to be nicer
plt.barh(ind, (infinity - interval[1][0]), height=0.8,
left = interval[1][0], alpha=alpha,
- color = palette[interval[0]])
+ color = palette[interval[0]],
+ linewidth=0)
ind = ind + 1
+ if legend:
+ dimensions = list(set(item[0] for item in persistence))
+ plt.legend(handles=[mpatches.Patch(color=palette[dim],
+ label=str(dim)) for dim in dimensions],
+ loc='lower right')
plt.title('Persistence barcode')
# Ends plot on infinity value and starts a little bit before min_birth
plt.axis([axis_start, infinity, 0, ind])
return plt
-def plot_persistence_diagram(persistence=[], persistence_file='', alpha=0.6, band_boot=0., max_plots=0):
- """This function plots the persistence diagram with an optional confidence band.
+def plot_persistence_diagram(persistence=[], persistence_file='', alpha=0.6,
+ band=0., max_plots=1000, inf_delta=0.1, legend=False):
+ """This function plots the persistence diagram from persistence values list
+ or from a :doc:`persistence file <fileformats>`.
- :param persistence: The persistence to plot.
+ :param persistence: Persistence values list.
:type persistence: list of tuples(dimension, tuple(birth, death)).
- :param persistence_file: A persistence file style name (reset persistence if both are set).
+ :param persistence_file: A :doc:`persistence file <fileformats>` style name
+ (reset persistence if both are set).
:type persistence_file: string
- :param alpha: alpha value in [0.0, 1.0] for points and horizontal infinity line (default is 0.6).
+ :param alpha: plot transparency value (0.0 transparent through 1.0 opaque - default is 0.6).
:type alpha: float.
- :param band_boot: bootstrap band (not displayed if :math:`\leq` 0.)
- :type band_boot: float.
+ :param band: band (not displayed if :math:`\leq` 0. - default is 0.)
+ :type band: float.
:param max_plots: number of maximal plots to be displayed
+ Set it to 0 to see all, Default value is 1000.
+ (persistence will be sorted by life time if max_plots is set)
:type max_plots: int.
- :returns: plot -- A diagram plot of persistence.
+ :param inf_delta: Infinity is placed at ((max_death - min_birth) x inf_delta).
+ A reasonable value is between 0.05 and 0.5 - default is 0.1.
+ :type inf_delta: float.
+ :returns: A matplotlib object containing diagram plot of persistence
+ (launch `show()` method on it to display it).
"""
if persistence_file is not '':
if os.path.isfile(persistence_file):
@@ -164,9 +173,9 @@ def plot_persistence_diagram(persistence=[], persistence_file='', alpha=0.6, ban
# Sort by life time, then takes only the max_plots elements
persistence = sorted(persistence, key=lambda life_time: life_time[1][1]-life_time[1][0], reverse=True)[:max_plots]
- (min_birth, max_death) = __min_birth_max_death(persistence, band_boot)
+ (min_birth, max_death) = __min_birth_max_death(persistence, band)
ind = 0
- delta = ((max_death - min_birth) / 10.0)
+ delta = ((max_death - min_birth) * inf_delta)
# Replace infinity values with max_death + delta for diagram to be more
# readable
infinity = max_death + delta
@@ -179,8 +188,8 @@ def plot_persistence_diagram(persistence=[], persistence_file='', alpha=0.6, ban
plt.plot(x, [infinity] * len(x), linewidth=1.0, color='k', alpha=alpha)
plt.text(axis_start, infinity, r'$\infty$', color='k', alpha=alpha)
# bootstrap band
- if band_boot > 0.:
- plt.fill_between(x, x, x+band_boot, alpha=alpha, facecolor='red')
+ if band > 0.:
+ plt.fill_between(x, x, x+band, alpha=alpha, facecolor='red')
# Draw points in loop
for interval in reversed(persistence):
@@ -194,6 +203,10 @@ def plot_persistence_diagram(persistence=[], persistence_file='', alpha=0.6, ban
color = palette[interval[0]])
ind = ind + 1
+ if legend:
+ dimensions = list(set(item[0] for item in persistence))
+ plt.legend(handles=[mpatches.Patch(color=palette[dim], label=str(dim)) for dim in dimensions])
+
plt.title('Persistence diagram')
plt.xlabel('Birth')
plt.ylabel('Death')
diff --git a/cython/cython/reader_utils.pyx b/cython/cython/reader_utils.pyx
index 3a17c5a0..e4572db0 100644
--- a/cython/cython/reader_utils.pyx
+++ b/cython/cython/reader_utils.pyx
@@ -11,7 +11,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2017 INRIA
+ Copyright (C) 2017 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2017 INRIA"
+__copyright__ = "Copyright (C) 2017 Inria"
__license__ = "GPL v3"
cdef extern from "Reader_utils_interface.h" namespace "Gudhi":
diff --git a/cython/cython/rips_complex.pyx b/cython/cython/rips_complex.pyx
index ad9b0a4d..59c16bff 100644
--- a/cython/cython/rips_complex.pyx
+++ b/cython/cython/rips_complex.pyx
@@ -11,7 +11,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,14 +28,12 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Rips_complex_interface.h" namespace "Gudhi":
cdef cppclass Rips_complex_interface "Gudhi::rips_complex::Rips_complex_interface":
Rips_complex_interface(vector[vector[double]] values, double threshold, bool euclidean)
- # bool from_file is a workaround for cython to find the correct signature
- Rips_complex_interface(string file_name, double threshold, bool euclidean, bool from_file)
void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, int dim_max)
# RipsComplex python interface
@@ -49,7 +47,7 @@ cdef class RipsComplex:
cdef Rips_complex_interface * thisptr
# Fake constructor that does nothing but documenting the constructor
- def __init__(self, points=None, off_file='', distance_matrix=None, csv_file='', max_edge_length=float('inf')):
+ def __init__(self, points=None, distance_matrix=None, max_edge_length=float('inf')):
"""RipsComplex constructor.
:param max_edge_length: Rips value.
@@ -60,41 +58,14 @@ cdef class RipsComplex:
Or
- :param off_file: An OFF file style name.
- :type off_file: string
-
- Or
-
:param distance_matrix: A distance matrix (full square or lower
triangular).
:type points: list of list of double
-
- Or
-
- :param csv_file: A csv file style name containing a full square or a
- lower triangular distance matrix.
- :type csv_file: string
"""
# The real cython constructor
- def __cinit__(self, points=None, off_file='', distance_matrix=None, csv_file='', max_edge_length=float('inf')):
- if off_file is not '':
- if os.path.isfile(off_file):
- self.thisptr = new Rips_complex_interface(str.encode(off_file),
- max_edge_length,
- True,
- True)
- else:
- print("file " + off_file + " not found.")
- elif csv_file is not '':
- if os.path.isfile(csv_file):
- self.thisptr = new Rips_complex_interface(str.encode(csv_file),
- max_edge_length,
- False,
- True)
- else:
- print("file " + csv_file + " not found.")
- elif distance_matrix is not None:
+ def __cinit__(self, points=None, distance_matrix=None, max_edge_length=float('inf')):
+ if distance_matrix is not None:
self.thisptr = new Rips_complex_interface(distance_matrix, max_edge_length, False)
else:
if points is None:
diff --git a/cython/cython/simplex_tree.pyx b/cython/cython/simplex_tree.pyx
index 0cb575d2..e302486b 100644
--- a/cython/cython/simplex_tree.pyx
+++ b/cython/cython/simplex_tree.pyx
@@ -10,7 +10,7 @@ from libcpp.string cimport string
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ from libcpp.string cimport string
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
@@ -55,6 +55,7 @@ cdef extern from "Simplex_tree_interface.h" namespace "Gudhi":
void expansion(int max_dim)
void remove_maximal_simplex(vector[int] simplex)
bool prune_above_filtration(double filtration)
+ bool make_filtration_non_decreasing()
cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi":
cdef cppclass Simplex_tree_persistence_interface "Gudhi::Persistent_cohomology_interface<Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_full_featured>>":
@@ -64,6 +65,7 @@ cdef extern from "Persistent_cohomology_interface.h" namespace "Gudhi":
vector[int] persistent_betti_numbers(double from_value, double to_value)
vector[pair[double,double]] intervals_in_dimension(int dimension)
void write_output_diagram(string diagram_file_name)
+ vector[pair[vector[int], vector[int]]] persistence_pairs()
# SimplexTree python interface
cdef class SimplexTree:
@@ -399,6 +401,26 @@ cdef class SimplexTree:
"""
self.thisptr.expansion(max_dim)
+ def make_filtration_non_decreasing(self):
+ """This function ensures that each simplex has a higher filtration
+ value than its faces by increasing the filtration values.
+
+ :returns: The filtration modification information.
+ :rtype: bint
+
+
+ .. note::
+
+ Some simplex tree functions require the filtration to be valid.
+ make_filtration_non_decreasing function is not launching
+ :func:`initialize_filtration()<gudhi.SimplexTree.initialize_filtration>`
+ but returns the filtration modification
+ information. If the complex has changed , please call
+ :func:`initialize_filtration()<gudhi.SimplexTree.initialize_filtration>`
+ to recompute it.
+ """
+ return self.thisptr.make_filtration_non_decreasing()
+
def persistence(self, homology_coeff_field=11, min_persistence=0, persistence_dim_max = False):
"""This function returns the persistence of the simplicial complex.
@@ -486,6 +508,25 @@ cdef class SimplexTree:
" to be launched first.")
return intervals_result
+ def persistence_pairs(self):
+ """This function returns the persistence pairs of the simplicial
+ complex.
+
+ :returns: The persistence intervals.
+ :rtype: list of pair of list of int
+
+ :note: intervals_in_dim function requires
+ :func:`persistence()<gudhi.SimplexTree.persistence>`
+ function to be launched first.
+ """
+ cdef vector[pair[vector[int],vector[int]]] persistence_pairs_result
+ if self.pcohptr != NULL:
+ persistence_pairs_result = self.pcohptr.persistence_pairs()
+ else:
+ print("persistence_pairs function requires persistence function"
+ " to be launched first.")
+ return persistence_pairs_result
+
def write_persistence_diagram(self, persistence_file=''):
"""This function writes the persistence intervals of the simplicial
complex in a user given file name.
diff --git a/cython/cython/strong_witness_complex.pyx b/cython/cython/strong_witness_complex.pyx
index 770b46f5..74c5cb05 100644
--- a/cython/cython/strong_witness_complex.pyx
+++ b/cython/cython/strong_witness_complex.pyx
@@ -8,7 +8,7 @@ from libcpp.utility cimport pair
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ from libcpp.utility cimport pair
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Strong_witness_complex_interface.h" namespace "Gudhi":
diff --git a/cython/cython/subsampling.pyx b/cython/cython/subsampling.pyx
index 894a4fbe..ac09b7a3 100644
--- a/cython/cython/subsampling.pyx
+++ b/cython/cython/subsampling.pyx
@@ -10,7 +10,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Subsampling_interface.h" namespace "Gudhi::subsampling":
diff --git a/cython/cython/tangential_complex.pyx b/cython/cython/tangential_complex.pyx
index d55bb050..4bb07076 100644
--- a/cython/cython/tangential_complex.pyx
+++ b/cython/cython/tangential_complex.pyx
@@ -11,7 +11,7 @@ import os
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -28,14 +28,14 @@ import os
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Tangential_complex_interface.h" namespace "Gudhi":
cdef cppclass Tangential_complex_interface "Gudhi::tangential_complex::Tangential_complex_interface":
- Tangential_complex_interface(vector[vector[double]] points)
+ Tangential_complex_interface(int intrisic_dim, vector[vector[double]] points)
# bool from_file is a workaround for cython to find the correct signature
- Tangential_complex_interface(string off_file, bool from_file)
+ Tangential_complex_interface(int intrisic_dim, string off_file, bool from_file)
vector[double] get_point(unsigned vertex)
unsigned number_of_vertices()
unsigned number_of_simplices()
@@ -54,9 +54,12 @@ cdef class TangentialComplex:
cdef Tangential_complex_interface * thisptr
# Fake constructor that does nothing but documenting the constructor
- def __init__(self, points=None, off_file=''):
+ def __init__(self, intrisic_dim, points=None, off_file=''):
"""TangentialComplex constructor.
+ :param intrisic_dim: Intrinsic dimension of the manifold.
+ :type intrisic_dim: integer
+
:param points: A list of points in d-Dimension.
:type points: list of list of double
@@ -67,17 +70,17 @@ cdef class TangentialComplex:
"""
# The real cython constructor
- def __cinit__(self, points=None, off_file=''):
+ def __cinit__(self, intrisic_dim, points=None, off_file=''):
if off_file is not '':
if os.path.isfile(off_file):
- self.thisptr = new Tangential_complex_interface(str.encode(off_file), True)
+ self.thisptr = new Tangential_complex_interface(intrisic_dim, str.encode(off_file), True)
else:
print("file " + off_file + " not found.")
else:
if points is None:
# Empty tangential construction
points=[]
- self.thisptr = new Tangential_complex_interface(points)
+ self.thisptr = new Tangential_complex_interface(intrisic_dim, points)
def __dealloc__(self):
diff --git a/cython/cython/witness_complex.pyx b/cython/cython/witness_complex.pyx
index 96d122bb..8591465a 100644
--- a/cython/cython/witness_complex.pyx
+++ b/cython/cython/witness_complex.pyx
@@ -8,7 +8,7 @@ from libcpp.utility cimport pair
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ from libcpp.utility cimport pair
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
cdef extern from "Witness_complex_interface.h" namespace "Gudhi":
diff --git a/cython/doc/_templates/layout.html b/cython/doc/_templates/layout.html
index 8e4eba40..1161ed8e 100644
--- a/cython/doc/_templates/layout.html
+++ b/cython/doc/_templates/layout.html
@@ -56,6 +56,12 @@
</a></p>
{%- endif %}
{%- endblock %}
+ <h2><a href="index.html">GUDHI</a></h2>
+ <h2><a href="fileformats.html">File formats</a></h2>
+ <h2><a href="installation.html">GUDHI installation</a></h2>
+ <h2><a href="citation.html">Acknowledging the GUDHI library</a></h2>
+ <h2><a href="genindex.html">Index</a></h2>
+ <h2><a href="examples.html">Examples</a></h2>
{%- if sidebars != None %}
{#- new style sidebar: explicitly include/exclude templates #}
{%- for sidebartemplate in sidebars %}
@@ -64,13 +70,6 @@
{%- else %}
{#- old style sidebars: using blocks -- should be deprecated #}
{%- block sidebartoc %}
-<h2><a href="index.html">GUDHI</a></h2>
-<h2><a href="fileformats.html">File formats</a></h2>
-<h2><a href="installation.html">GUDHI installation</a></h2>
-<h2><a href="citation.html">Acknowledging the GUDHI library</a></h2>
-<h2><a href="genindex.html">Index</a></h2>
-<h2><a href="examples.html">Examples</a></h2>
-
{%- include "localtoc.html" %}
{%- endblock %}
{%- block sidebarrel %}
@@ -166,60 +165,61 @@
<body role="document">
<!-- GUDHI website header BEGIN -->
<div id="navigation" class="sticky">
- <nav class="top-bar" role="navigation" data-topbar>
- <ul class="title-area">
- <li class="name">
- <h1 class="show-for-small-only"><a href="http://gudhi.gforge.inria.fr" class="icon-tree"> GUDHI C++ library</a></h1>
- </li>
- <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
- <li class="toggle-topbar menu-icon"><a href="#"><span>Navigation</span></a></li>
- </ul>
- <section class="top-bar-section">
- <ul class="right">
- <li class="divider"></li>
- <li><a href="http://gudhi.gforge.inria.fr/contact/">Contact</a></li>
- </ul>
- <ul class="left">
- <li><a href="http://gudhi.gforge.inria.fr/"> <img src="http://gudhi.gforge.inria.fr/assets/img/home.png" alt="&nbsp;&nbsp;GUDHI">&nbsp;&nbsp;GUDHI </a></li>
- <li class="divider"></li>
- <li class="has-dropdown">
- <a href="#">Project</a>
- <ul class="dropdown">
- <li><a href="http://gudhi.gforge.inria.fr/people/">People</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/keepintouch/">Keep in touch</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/partners/">Partners and Funding</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/relatedprojects/">Related projects</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/theyaretalkingaboutus/">They are talking about us</a></li>
- </ul>
- </li>
- <li class="divider"></li>
- <li class="has-dropdown">
- <a href="#">Download</a>
- <ul class="dropdown">
- <li><a href="http://gudhi.gforge.inria.fr/licensing/">Licensing</a></li>
- <li><a href="https://gforge.inria.fr/frs/?group_id=3865" target="_blank">Get the sources</a></li>
- <li><a href="https://gforge.inria.fr/frs/download.php/file/37113/GUDHI_2.0.0_OSX_UTILS.beta.tar.gz" target="_blank">Utils for Mac OSx</a></li>
- <li><a href="https://gforge.inria.fr/frs/download.php/file/37112/GUDHI_2.0.0_WIN64_UTILS.beta.zip" target="_blank">Utils for Win x64</a></li>
- </ul>
- </li>
- <li class="divider"></li>
- <li class="has-dropdown">
- <a href="#">Documentation</a>
- <ul class="dropdown">
- <li><a href="http://gudhi.gforge.inria.fr/doc/latest/">C++ documentation</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/doc/latest/installation.html">C++ installation manual</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/python/latest/">Python documentation</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/python/latest/installation.html">Python installation manual</a></li>
- <li><a href="http://gudhi.gforge.inria.fr/utils/">Utilities</a></li>
- <li><a href="http://bertrand.michel.perso.math.cnrs.fr/Enseignements/TDA-Gudhi-Python.html" target="_blank">Tutorial</a></li>
- </ul>
- </li>
- <li class="divider"></li>
- <li><a href="http://gudhi.gforge.inria.fr/interfaces/">Interfaces</a></li>
- <li class="divider"></li>
- </ul>
- </section>
- </nav>
+ <nav class="top-bar" role="navigation" data-topbar>
+ <ul class="title-area">
+ <li class="name">
+ <h1 class="show-for-small-only"><a href="" class="icon-tree"> GUDHI C++ library</a></h1>
+ </li>
+ <!-- Remove the class "menu-icon" to get rid of menu icon. Take out "Menu" to just have icon alone -->
+ <li class="toggle-topbar menu-icon"><a href="#"><span>Navigation</span></a></li>
+ </ul>
+ <section class="top-bar-section">
+ <ul class="right">
+ <li class="divider"></li>
+ <li><a href="/contact/">Contact</a></li>
+ </ul>
+ <ul class="left">
+ <li><a href="/"> <img src="/assets/img/home.png" alt="&nbsp;&nbsp;GUDHI">&nbsp;&nbsp;GUDHI </a></li>
+ <li class="divider"></li>
+ <li class="has-dropdown">
+ <a href="#">Project</a>
+ <ul class="dropdown">
+ <li><a href="/people/">People</a></li>
+ <li><a href="/keepintouch/">Keep in touch</a></li>
+ <li><a href="/partners/">Partners and Funding</a></li>
+ <li><a href="/relatedprojects/">Related projects</a></li>
+ <li><a href="/theyaretalkingaboutus/">They are talking about us</a></li>
+ </ul>
+ </li>
+ <li class="divider"></li>
+ <li class="has-dropdown">
+ <a href="#">Download</a>
+ <ul class="dropdown">
+ <li><a href="/licensing/">Licensing</a></li>
+ <li><a href="https://gforge.inria.fr/frs/download.php/latestzip/5253/library-latest.zip" target="_blank">Get the latest sources</a></li>
+ <li><a href="https://gforge.inria.fr/frs/download.php/latestzip/5280/utils_osx-latest.zip" target="_blank">Utils for Mac OSx</a></li>
+ <li><a href="https://gforge.inria.fr/frs/download.php/latestzip/5279/utils_win64-latest.zip" target="_blank">Utils for Win x64</a></li>
+ </ul>
+ </li>
+ <li class="divider"></li>
+ <li class="has-dropdown">
+ <a href="#">Documentation</a>
+ <ul class="dropdown">
+ <li><a href="/doc/latest/">C++ documentation</a></li>
+ <li><a href="/doc/latest/installation.html">C++ installation manual</a></li>
+ <li><a href="/python/latest/">Python documentation</a></li>
+ <li><a href="/python/latest/installation.html">Python installation manual</a></li>
+ <li><a href="/utils/">Utilities</a></li>
+ <li><a href="/tutorials/">Tutorials</a></li>
+ <li><a href="/dockerfile/">Dockerfile</a></li>
+ </ul>
+ </li>
+ <li class="divider"></li>
+ <li><a href="/interfaces/">Interfaces</a></li>
+ <li class="divider"></li>
+ </ul>
+ </section>
+ </nav>
</div><!-- /#navigation -->
<!-- GUDHI website header BEGIN -->
diff --git a/cython/doc/alpha_complex_ref.rst b/cython/doc/alpha_complex_ref.rst
index 6a122b09..7da79543 100644
--- a/cython/doc/alpha_complex_ref.rst
+++ b/cython/doc/alpha_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
==============================
Alpha complex reference manual
==============================
diff --git a/cython/doc/alpha_complex_sum.rst b/cython/doc/alpha_complex_sum.inc
index 1680a712..1680a712 100644
--- a/cython/doc/alpha_complex_sum.rst
+++ b/cython/doc/alpha_complex_sum.inc
diff --git a/cython/doc/alpha_complex_user.rst b/cython/doc/alpha_complex_user.rst
index db7edd6f..d1e9c7cd 100644
--- a/cython/doc/alpha_complex_user.rst
+++ b/cython/doc/alpha_complex_user.rst
@@ -1,11 +1,15 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Alpha complex user manual
=========================
Definition
----------
-.. include:: alpha_complex_sum.rst
+.. include:: alpha_complex_sum.inc
-Alpha_complex is constructing a :doc:`Simplex_tree <simplex_tree_sum>` using
+Alpha_complex is constructing a :doc:`Simplex_tree <simplex_tree_ref>` using
`Delaunay Triangulation <http://doc.cgal.org/latest/Triangulation/index.html#Chapter_Triangulations>`_
:cite:`cgal:hdj-t-15b` from `CGAL <http://www.cgal.org/>`_ (the Computational Geometry Algorithms Library
:cite:`cgal:eb-15b`).
@@ -99,9 +103,9 @@ Filtration value computation algorithm
**end for**
**end for**
**end for**
-
+
make_filtration_non_decreasing()
-
+
prune_above_filtration()
Dimension 2
diff --git a/cython/doc/bottleneck_distance_sum.rst b/cython/doc/bottleneck_distance_sum.inc
index 030fad9e..030fad9e 100644
--- a/cython/doc/bottleneck_distance_sum.rst
+++ b/cython/doc/bottleneck_distance_sum.inc
diff --git a/cython/doc/bottleneck_distance_user.rst b/cython/doc/bottleneck_distance_user.rst
index 7692dce2..605db022 100644
--- a/cython/doc/bottleneck_distance_user.rst
+++ b/cython/doc/bottleneck_distance_user.rst
@@ -1,9 +1,13 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Bottleneck distance user manual
===============================
Definition
----------
-.. include:: bottleneck_distance_sum.rst
+.. include:: bottleneck_distance_sum.inc
Function
--------
diff --git a/cython/doc/citation.rst b/cython/doc/citation.rst
index f4fdf83b..117eb9dd 100644
--- a/cython/doc/citation.rst
+++ b/cython/doc/citation.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Acknowledging the GUDHI library
###############################
diff --git a/cython/doc/conf.py b/cython/doc/conf.py
index a13c9751..4a54d4fd 100755
--- a/cython/doc/conf.py
+++ b/cython/doc/conf.py
@@ -85,7 +85,7 @@ version = gudhi.__version__
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
-exclude_patterns = ['_build']
+exclude_patterns = ['_build', '*.inc']
# The reST default role (used for this markup: `text`) to use for all
# documents.
@@ -125,6 +125,7 @@ html_theme_options = {
"sidebarbgcolor": "#A1ADCD",
"sidebartextcolor": "black",
"sidebarlinkcolor": "#334D5C",
+ "body_max_width": "1200px",
}
# Add any paths that contain custom themes here, relative to this directory.
diff --git a/cython/doc/cubical_complex_ref.rst b/cython/doc/cubical_complex_ref.rst
index 84aa4223..1fe9d5fb 100644
--- a/cython/doc/cubical_complex_ref.rst
+++ b/cython/doc/cubical_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Cubical complex reference manual
################################
diff --git a/cython/doc/cubical_complex_sum.rst b/cython/doc/cubical_complex_sum.inc
index 280ad0e0..280ad0e0 100644
--- a/cython/doc/cubical_complex_sum.rst
+++ b/cython/doc/cubical_complex_sum.inc
diff --git a/cython/doc/cubical_complex_user.rst b/cython/doc/cubical_complex_user.rst
index 34598f02..320bd79b 100644
--- a/cython/doc/cubical_complex_user.rst
+++ b/cython/doc/cubical_complex_user.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Cubical complex user manual
===========================
Definition
@@ -144,6 +148,7 @@ the program output is:
.. testoutput::
Periodic cubical complex is of dimension 2 - 42 simplices.
+
Examples.
---------
@@ -152,6 +157,6 @@ End user programs are available in cython/example/ folder.
Bibliography
============
-.. bibliography:: ../../bibliography.bib
+.. bibliography:: ../../biblio/bibliography.bib
:filter: docnames
:style: unsrt
diff --git a/cython/doc/euclidean_strong_witness_complex_ref.rst b/cython/doc/euclidean_strong_witness_complex_ref.rst
index bebf0f9a..1a602cd5 100644
--- a/cython/doc/euclidean_strong_witness_complex_ref.rst
+++ b/cython/doc/euclidean_strong_witness_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
=================================================
Euclidean strong witness complex reference manual
=================================================
diff --git a/cython/doc/euclidean_witness_complex_ref.rst b/cython/doc/euclidean_witness_complex_ref.rst
index 29b8806f..28daf965 100644
--- a/cython/doc/euclidean_witness_complex_ref.rst
+++ b/cython/doc/euclidean_witness_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
==========================================
Euclidean witness complex reference manual
==========================================
diff --git a/cython/doc/examples.rst b/cython/doc/examples.rst
index 1e596e18..d42f5a92 100644
--- a/cython/doc/examples.rst
+++ b/cython/doc/examples.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Examples
########
diff --git a/cython/doc/fileformats.rst b/cython/doc/fileformats.rst
index 4f0b6f6d..ff20f26e 100644
--- a/cython/doc/fileformats.rst
+++ b/cython/doc/fileformats.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
File formats
############
diff --git a/cython/doc/index.rst b/cython/doc/index.rst
index 3945d72a..4e444fb0 100644
--- a/cython/doc/index.rst
+++ b/cython/doc/index.rst
@@ -34,32 +34,32 @@ Data structures
Alpha complex
=============
-.. include:: alpha_complex_sum.rst
+.. include:: alpha_complex_sum.inc
Cubical complex
===============
-.. include:: cubical_complex_sum.rst
+.. include:: cubical_complex_sum.inc
Rips complex
============
-.. include:: rips_complex_sum.rst
+.. include:: rips_complex_sum.inc
Simplex tree
============
-.. include:: simplex_tree_sum.rst
+.. include:: simplex_tree_sum.inc
Tangential complex
==================
-.. include:: tangential_complex_sum.rst
+.. include:: tangential_complex_sum.inc
Witness complex
===============
-.. include:: witness_complex_sum.rst
+.. include:: witness_complex_sum.inc
Toolbox
@@ -68,17 +68,17 @@ Toolbox
Bottleneck distance
===================
-.. include:: bottleneck_distance_sum.rst
+.. include:: bottleneck_distance_sum.inc
Persistence cohomology
======================
-.. include:: persistent_cohomology_sum.rst
+.. include:: persistent_cohomology_sum.inc
Persistence graphical tools
===========================
-.. include:: persistence_graphical_tools_sum.rst
+.. include:: persistence_graphical_tools_sum.inc
Bibliography
************
diff --git a/cython/doc/installation.rst b/cython/doc/installation.rst
index c182f176..43ff85c5 100644
--- a/cython/doc/installation.rst
+++ b/cython/doc/installation.rst
@@ -1,12 +1,16 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Installation
############
Compiling
*********
-
-The library uses c++11 and requires `Boost <http://www.boost.org/>`_ with
-version 1.48.0 or more recent. It is a multi-platform library and compiles on
-Linux, Mac OSX and Visual Studio 2015.
+The library uses c++11 and requires `Boost <https://www.boost.org/>`_ ≥ 1.48.0
+and `CMake <https://www.cmake.org/>`_ ≥ 3.1.
+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.
@@ -43,6 +47,9 @@ following command in a terminal:
export PYTHONPATH='$PYTHONPATH:/path-to-gudhi/build/cython'
ctest -R py_test
+If tests fail, please try to :code:`import gudhi` and check the errors.
+The problem can come from a third-party library bad link or installation.
+
Documentation
=============
diff --git a/cython/doc/periodic_cubical_complex_ref.rst b/cython/doc/periodic_cubical_complex_ref.rst
index c6190a1b..4b831647 100644
--- a/cython/doc/periodic_cubical_complex_ref.rst
+++ b/cython/doc/periodic_cubical_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Periodic cubical complex reference manual
#########################################
diff --git a/cython/doc/persistence_graphical_tools_ref.rst b/cython/doc/persistence_graphical_tools_ref.rst
index 27c2f68a..a2c6bcef 100644
--- a/cython/doc/persistence_graphical_tools_ref.rst
+++ b/cython/doc/persistence_graphical_tools_ref.rst
@@ -1,8 +1,11 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
============================================
Persistence graphical tools reference manual
============================================
.. autofunction:: gudhi.__min_birth_max_death
-.. autofunction:: gudhi.show_palette_values
.. autofunction:: gudhi.plot_persistence_barcode
.. autofunction:: gudhi.plot_persistence_diagram
diff --git a/cython/doc/persistence_graphical_tools_sum.rst b/cython/doc/persistence_graphical_tools_sum.inc
index d602daa7..d602daa7 100644
--- a/cython/doc/persistence_graphical_tools_sum.rst
+++ b/cython/doc/persistence_graphical_tools_sum.inc
diff --git a/cython/doc/persistence_graphical_tools_user.rst b/cython/doc/persistence_graphical_tools_user.rst
index 9033331f..292915eb 100644
--- a/cython/doc/persistence_graphical_tools_user.rst
+++ b/cython/doc/persistence_graphical_tools_user.rst
@@ -1,49 +1,26 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Persistence graphical tools user manual
=======================================
Definition
----------
-.. include:: persistence_graphical_tools_sum.rst
-
-
-Show palette values
--------------------
-
-This function is useful to show the color palette values of dimension:
-
+.. include:: persistence_graphical_tools_sum.inc
-.. testcode::
-
- import gudhi
- plt = gudhi.show_palette_values(alpha=1.0)
- plt.show()
-
-.. plot::
-
- import gudhi
- plt = gudhi.show_palette_values(alpha=1.0)
- plt.show()
Show persistence as a barcode
-----------------------------
This function can display the persistence result as a barcode:
-.. testcode::
-
- import gudhi
-
- periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file=gudhi.__root_source_dir__ + \
- '/data/bitmap/3d_torus.txt')
- diag = periodic_cc.persistence()
- plt = gudhi.plot_persistence_barcode(diag)
- plt.show()
-
.. plot::
+ :include-source:
import gudhi
- periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file=gudhi.__root_source_dir__ + \
- '/data/bitmap/3d_torus.txt')
+ perseus_file = gudhi.__root_source_dir__ + '/data/bitmap/3d_torus.txt'
+ periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file=perseus_file)
diag = periodic_cc.persistence()
print("diag = ", diag)
plt = gudhi.plot_persistence_barcode(diag)
@@ -54,24 +31,32 @@ Show persistence as a diagram
This function can display the persistence result as a diagram:
-.. testcode::
+.. plot::
+ :include-source:
import gudhi
-
- rips_complex = gudhi.RipsComplex(off_file=gudhi.__root_source_dir__ + \
- '/data/points/tore3D_1307.off', max_edge_length=0.2)
- simplex_tree = rips_complex.create_simplex_tree(max_dimension=3)
- diag = simplex_tree.persistence()
- plt = gudhi.plot_persistence_diagram(diag, band_boot=0.13)
+
+ # rips_on_tore3D_1307.pers obtained from write_persistence_diagram method
+ persistence_file=gudhi.__root_source_dir__ + \
+ '/data/persistence_diagram/rips_on_tore3D_1307.pers'
+ plt = gudhi.plot_persistence_diagram(persistence_file=persistence_file,
+ legend=True)
plt.show()
+If you want more information on a specific dimension, for instance:
+
.. plot::
+ :include-source:
import gudhi
- rips_complex = gudhi.RipsComplex(off_file=gudhi.__root_source_dir__ + \
- '/data/points/tore3D_1307.off', max_edge_length=0.2)
- simplex_tree = rips_complex.create_simplex_tree(max_dimension=3)
- diag = simplex_tree.persistence()
- plt = gudhi.plot_persistence_diagram(diag, band_boot=0.13)
+ persistence_file=gudhi.__root_source_dir__ + \
+ '/data/persistence_diagram/rips_on_tore3D_1307.pers'
+ diag = \
+ gudhi.read_persistence_intervals_grouped_by_dimension(persistence_file=\
+ persistence_file)
+ dim = 1
+ # Display all points with some transparency
+ plt = gudhi.plot_persistence_diagram([(dim,interval) for interval in diag[dim]],
+ max_plots=0, alpha=0.1)
plt.show()
diff --git a/cython/doc/persistent_cohomology_sum.rst b/cython/doc/persistent_cohomology_sum.inc
index a26df1dc..a26df1dc 100644
--- a/cython/doc/persistent_cohomology_sum.rst
+++ b/cython/doc/persistent_cohomology_sum.inc
diff --git a/cython/doc/persistent_cohomology_user.rst b/cython/doc/persistent_cohomology_user.rst
index bf90c163..ce7fc685 100644
--- a/cython/doc/persistent_cohomology_user.rst
+++ b/cython/doc/persistent_cohomology_user.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Persistent cohomology user manual
=================================
Definition
diff --git a/cython/doc/pyplots/barcode_persistence.py b/cython/doc/pyplots/barcode_persistence.py
deleted file mode 100755
index de33d506..00000000
--- a/cython/doc/pyplots/barcode_persistence.py
+++ /dev/null
@@ -1,7 +0,0 @@
-import gudhi
-
-periodic_cc = gudhi.PeriodicCubicalComplex(perseus_file=gudhi.__root_source_dir__ + \
- '/data/bitmap/3d_torus.txt')
-diag = periodic_cc.persistence()
-plt = gudhi.plot_persistence_barcode(diag)
-plt.show()
diff --git a/cython/doc/pyplots/diagram_persistence.py b/cython/doc/pyplots/diagram_persistence.py
deleted file mode 100755
index c2fbf801..00000000
--- a/cython/doc/pyplots/diagram_persistence.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import gudhi
-
-rips_complex = gudhi.RipsComplex(off_file=gudhi.__root_source_dir__ + \
- '/data/points/tore3D_1307.off', max_edge_length=0.2)
-simplex_tree = rips_complex.create_simplex_tree(max_dimension=3)
-diag = simplex_tree.persistence()
-plt = gudhi.plot_persistence_diagram(diag, band_boot=0.13)
-plt.show()
diff --git a/cython/doc/pyplots/show_palette_values.py b/cython/doc/pyplots/show_palette_values.py
deleted file mode 100755
index fdf9645f..00000000
--- a/cython/doc/pyplots/show_palette_values.py
+++ /dev/null
@@ -1,3 +0,0 @@
-import gudhi
-plt = gudhi.show_palette_values(alpha=1.0)
-plt.show()
diff --git a/cython/doc/reader_utils_ref.rst b/cython/doc/reader_utils_ref.rst
index 9c1ea6fc..f3ecebad 100644
--- a/cython/doc/reader_utils_ref.rst
+++ b/cython/doc/reader_utils_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
=============================
Reader utils reference manual
=============================
diff --git a/cython/doc/rips_complex_ref.rst b/cython/doc/rips_complex_ref.rst
index b17dc4e0..22b5616c 100644
--- a/cython/doc/rips_complex_ref.rst
+++ b/cython/doc/rips_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
=============================
Rips complex reference manual
=============================
diff --git a/cython/doc/rips_complex_sum.rst b/cython/doc/rips_complex_sum.inc
index 5616bfa9..5616bfa9 100644
--- a/cython/doc/rips_complex_sum.rst
+++ b/cython/doc/rips_complex_sum.inc
diff --git a/cython/doc/rips_complex_user.rst b/cython/doc/rips_complex_user.rst
index 96ba9944..a8c06cf9 100644
--- a/cython/doc/rips_complex_user.rst
+++ b/cython/doc/rips_complex_user.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Rips complex user manual
=========================
Definition
@@ -101,8 +105,8 @@ Finally, it is asked to display information about the Rips complex.
.. testcode::
import gudhi
- rips_complex = gudhi.RipsComplex(off_file=gudhi.__root_source_dir__ + \
- '/data/points/alphacomplexdoc.off', max_edge_length=12.0)
+ point_cloud = gudhi.read_off(off_file=gudhi.__root_source_dir__ + '/data/points/alphacomplexdoc.off')
+ rips_complex = gudhi.RipsComplex(points=point_cloud, max_edge_length=12.0)
simplex_tree = rips_complex.create_simplex_tree(max_dimension=1)
result_str = 'Rips complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
@@ -197,7 +201,7 @@ Example from csv file
^^^^^^^^^^^^^^^^^^^^^
This example builds the :doc:`Rips_complex <rips_complex_ref>` from the given
-points in an OFF file, and max_edge_length value.
+distance matrix in a csv file, and max_edge_length value.
Then it creates a :doc:`Simplex_tree <simplex_tree_ref>` with it.
Finally, it is asked to display information about the Rips complex.
@@ -206,8 +210,9 @@ Finally, it is asked to display information about the Rips complex.
.. testcode::
import gudhi
- rips_complex = gudhi.RipsComplex(csv_file=gudhi.__root_source_dir__ + \
- '/data/distance_matrix/full_square_distance_matrix.csv', max_edge_length=12.0)
+ distance_matrix = gudhi.read_lower_triangular_matrix_from_csv_file(csv_file=gudhi.__root_source_dir__ + \
+ '/data/distance_matrix/full_square_distance_matrix.csv')
+ rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix, max_edge_length=12.0)
simplex_tree = rips_complex.create_simplex_tree(max_dimension=1)
result_str = 'Rips complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \
repr(simplex_tree.num_simplices()) + ' simplices - ' + \
@@ -240,3 +245,72 @@ the program output is:
[0, 3] -> 9.43
[4, 6] -> 9.49
[3, 6] -> 11.00
+
+Correlation matrix
+------------------
+
+Example from a correlation matrix
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Analogously to the case of distance matrix, Rips complexes can be also constructed based on correlation matrix.
+Given a correlation matrix M, comportment-wise 1-M is a distance matrix.
+This example builds the one skeleton graph from the given corelation matrix and threshold value.
+Then it creates a :doc:`Simplex_tree <simplex_tree_ref>` with it.
+
+Finally, it is asked to display information about the simplicial complex.
+
+.. testcode::
+
+ import gudhi
+ import numpy as np
+
+ # User defined correlation matrix is:
+ # |1 0.06 0.23 0.01 0.89|
+ # |0.06 1 0.74 0.01 0.61|
+ # |0.23 0.74 1 0.72 0.03|
+ # |0.01 0.01 0.72 1 0.7 |
+ # |0.89 0.61 0.03 0.7 1 |
+ correlation_matrix=np.array([[1., 0.06, 0.23, 0.01, 0.89],
+ [0.06, 1., 0.74, 0.01, 0.61],
+ [0.23, 0.74, 1., 0.72, 0.03],
+ [0.01, 0.01, 0.72, 1., 0.7],
+ [0.89, 0.61, 0.03, 0.7, 1.]], float)
+
+ distance_matrix = np.ones((correlation_matrix.shape),float) - correlation_matrix
+ rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix, max_edge_length=1.0)
+
+ simplex_tree = rips_complex.create_simplex_tree(max_dimension=1)
+ result_str = 'Rips complex is of dimension ' + repr(simplex_tree.dimension()) + ' - ' + \
+ repr(simplex_tree.num_simplices()) + ' simplices - ' + \
+ repr(simplex_tree.num_vertices()) + ' vertices.'
+ print(result_str)
+ fmt = '%s -> %.2f'
+ for filtered_value in simplex_tree.get_filtration():
+ print(fmt % tuple(filtered_value))
+
+When launching (Rips maximal distance between 2 points is 12.0, is expanded
+until dimension 1 - one skeleton graph in other words), the output is:
+
+.. testoutput::
+
+ Rips complex is of dimension 1 - 15 simplices - 5 vertices.
+ [0] -> 0.00
+ [1] -> 0.00
+ [2] -> 0.00
+ [3] -> 0.00
+ [4] -> 0.00
+ [0, 4] -> 0.11
+ [1, 2] -> 0.26
+ [2, 3] -> 0.28
+ [3, 4] -> 0.30
+ [1, 4] -> 0.39
+ [0, 2] -> 0.77
+ [0, 1] -> 0.94
+ [2, 4] -> 0.97
+ [0, 3] -> 0.99
+ [1, 3] -> 0.99
+
+.. note::
+ As persistence diagrams points will be under the diagonal,
+ bottleneck distance and persistence graphical tool will not work properly,
+ this is a known issue.
diff --git a/cython/doc/simplex_tree_ref.rst b/cython/doc/simplex_tree_ref.rst
index 6d196843..9eb8c199 100644
--- a/cython/doc/simplex_tree_ref.rst
+++ b/cython/doc/simplex_tree_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
=============================
Simplex tree reference manual
=============================
diff --git a/cython/doc/simplex_tree_sum.rst b/cython/doc/simplex_tree_sum.inc
index fb0e54c1..fb0e54c1 100644
--- a/cython/doc/simplex_tree_sum.rst
+++ b/cython/doc/simplex_tree_sum.inc
diff --git a/cython/doc/simplex_tree_user.rst b/cython/doc/simplex_tree_user.rst
index 4b1dde19..aebeb29f 100644
--- a/cython/doc/simplex_tree_user.rst
+++ b/cython/doc/simplex_tree_user.rst
@@ -1,9 +1,13 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Simplex tree user manual
========================
Definition
----------
-.. include:: simplex_tree_sum.rst
+.. include:: simplex_tree_sum.inc
A simplicial complex :math:`\mathbf{K}` on a set of vertices :math:`V = \{1, \cdots ,|V|\}` is a collection of
simplices :math:`\{\sigma\}`, :math:`\sigma \subseteq V` such that
diff --git a/cython/doc/strong_witness_complex_ref.rst b/cython/doc/strong_witness_complex_ref.rst
index 4ed4fe46..d624d711 100644
--- a/cython/doc/strong_witness_complex_ref.rst
+++ b/cython/doc/strong_witness_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
=======================================
Strong witness complex reference manual
=======================================
diff --git a/cython/doc/tangential_complex_ref.rst b/cython/doc/tangential_complex_ref.rst
index 35589475..cdfda082 100644
--- a/cython/doc/tangential_complex_ref.rst
+++ b/cython/doc/tangential_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
===================================
Tangential complex reference manual
===================================
diff --git a/cython/doc/tangential_complex_sum.rst b/cython/doc/tangential_complex_sum.inc
index 72b4d7ba..72b4d7ba 100644
--- a/cython/doc/tangential_complex_sum.rst
+++ b/cython/doc/tangential_complex_sum.inc
diff --git a/cython/doc/tangential_complex_user.rst b/cython/doc/tangential_complex_user.rst
index efa6d7ce..5ce69e86 100644
--- a/cython/doc/tangential_complex_user.rst
+++ b/cython/doc/tangential_complex_user.rst
@@ -1,6 +1,10 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Tangential complex user manual
==============================
-.. include:: tangential_complex_sum.rst
+.. include:: tangential_complex_sum.inc
Definition
----------
@@ -122,8 +126,8 @@ This example builds the Tangential complex of point set read in an OFF file.
.. testcode::
import gudhi
- tc = gudhi.TangentialComplex(off_file=gudhi.__root_source_dir__ + \
- '/data/points/alphacomplexdoc.off')
+ tc = gudhi.TangentialComplex(intrisic_dim = 1,
+ off_file=gudhi.__root_source_dir__ + '/data/points/alphacomplexdoc.off')
result_str = 'Tangential contains ' + repr(tc.num_simplices()) + \
' simplices - ' + repr(tc.num_vertices()) + ' vertices.'
print(result_str)
@@ -169,7 +173,8 @@ simplices.
.. testcode::
import gudhi
- tc = gudhi.TangentialComplex(points=[[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]])
+ tc = gudhi.TangentialComplex(intrisic_dim = 1,
+ points=[[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]])
result_str = 'Tangential contains ' + repr(tc.num_vertices()) + ' vertices.'
print(result_str)
diff --git a/cython/doc/todos.rst b/cython/doc/todos.rst
index 78972a4c..ca274ced 100644
--- a/cython/doc/todos.rst
+++ b/cython/doc/todos.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
==========
To be done
==========
diff --git a/cython/doc/witness_complex_ref.rst b/cython/doc/witness_complex_ref.rst
index c78760cb..9987d3fd 100644
--- a/cython/doc/witness_complex_ref.rst
+++ b/cython/doc/witness_complex_ref.rst
@@ -1,3 +1,7 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
================================
Witness complex reference manual
================================
diff --git a/cython/doc/witness_complex_sum.rst b/cython/doc/witness_complex_sum.inc
index a8a126a0..a8a126a0 100644
--- a/cython/doc/witness_complex_sum.rst
+++ b/cython/doc/witness_complex_sum.inc
diff --git a/cython/doc/witness_complex_user.rst b/cython/doc/witness_complex_user.rst
index 99be5185..40e94134 100644
--- a/cython/doc/witness_complex_user.rst
+++ b/cython/doc/witness_complex_user.rst
@@ -1,7 +1,11 @@
+:orphan:
+
+.. To get rid of WARNING: document isn't included in any toctree
+
Witness complex user manual
===========================
-.. include:: witness_complex_sum.rst
+.. include:: witness_complex_sum.inc
Definitions
-----------
diff --git a/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py b/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
index b4487be4..4abe22d4 100755
--- a/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
+++ b/cython/example/alpha_complex_diagram_persistence_from_off_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='AlphaComplex creation from '
@@ -38,7 +38,7 @@ parser = argparse.ArgumentParser(description='AlphaComplex creation from '
'points from the given OFF file.')
parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument("-a", "--max_alpha_square", type=float, default=0.5)
-parser.add_argument("-b", "--band_boot", type=float, default=0.)
+parser.add_argument("-b", "--band", type=float, default=0.)
parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
args = parser.parse_args()
@@ -64,7 +64,7 @@ with open(args.file, 'r') as f:
print(simplex_tree.betti_numbers())
if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band_boot=args.band_boot)
+ pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
pplot.show()
else:
print(args.file, "is not a valid OFF file")
diff --git a/cython/example/alpha_complex_from_points_example.py b/cython/example/alpha_complex_from_points_example.py
index 7d6278ce..ad73c744 100755
--- a/cython/example/alpha_complex_from_points_example.py
+++ b/cython/example/alpha_complex_from_points_example.py
@@ -8,7 +8,7 @@ from gudhi import AlphaComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ from gudhi import AlphaComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
print("#####################################################################")
diff --git a/cython/example/alpha_rips_persistence_bottleneck_distance.py b/cython/example/alpha_rips_persistence_bottleneck_distance.py
index ab5fc1e9..b51fa7a8 100755
--- a/cython/example/alpha_rips_persistence_bottleneck_distance.py
+++ b/cython/example/alpha_rips_persistence_bottleneck_distance.py
@@ -10,7 +10,7 @@ import math
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -27,7 +27,7 @@ import math
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='AlphaComplex and RipsComplex '
@@ -45,13 +45,14 @@ args = parser.parse_args()
with open(args.file, 'r') as f:
first_line = f.readline()
if (first_line == 'OFF\n') or (first_line == 'nOFF\n'):
+ point_cloud = gudhi.read_off(off_file=args.file)
print("#####################################################################")
print("RipsComplex creation from points read in a OFF file")
message = "RipsComplex with max_edge_length=" + repr(args.threshold)
print(message)
- rips_complex = gudhi.RipsComplex(off_file=args.file,
+ rips_complex = gudhi.RipsComplex(points=point_cloud,
max_edge_length=args.threshold)
rips_stree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
@@ -67,7 +68,7 @@ with open(args.file, 'r') as f:
message = "AlphaComplex with max_edge_length=" + repr(args.threshold)
print(message)
- alpha_complex = gudhi.AlphaComplex(off_file=args.file)
+ alpha_complex = gudhi.AlphaComplex(points=point_cloud)
alpha_stree = alpha_complex.create_simplex_tree(max_alpha_square=(args.threshold * args.threshold))
message = "Number of simplices=" + repr(alpha_stree.num_simplices())
diff --git a/cython/example/bottleneck_basic_example.py b/cython/example/bottleneck_basic_example.py
index 31cecb29..287956e7 100755
--- a/cython/example/bottleneck_basic_example.py
+++ b/cython/example/bottleneck_basic_example.py
@@ -8,7 +8,7 @@ import gudhi
Author(s): Francois Godi, Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,11 +25,9 @@ import gudhi
"""
__author__ = "Francois Godi, Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
-import gudhi
-
diag1 = [[2.7, 3.7],[9.6, 14.],[34.2, 34.974], [3.,float('Inf')]]
diag2 = [[2.8, 4.45],[9.5, 14.1],[3.2,float('Inf')]]
diff --git a/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py b/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
index e3f362dc..3b29781f 100755
--- a/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
+++ b/cython/example/euclidean_strong_witness_complex_diagram_persistence_from_off_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='EuclideanStrongWitnessComplex creation from '
@@ -40,7 +40,7 @@ parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument("-a", "--max_alpha_square", type=float, required=True)
parser.add_argument("-n", "--number_of_landmarks", type=int, required=True)
parser.add_argument("-d", "--limit_dimension", type=int, required=True)
-parser.add_argument("-b", "--band_boot", type=float, default=0.)
+parser.add_argument("-b", "--band", type=float, default=0.)
parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
args = parser.parse_args()
@@ -71,7 +71,7 @@ with open(args.file, 'r') as f:
print(simplex_tree.betti_numbers())
if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band_boot=args.band_boot)
+ pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
pplot.show()
else:
print(args.file, "is not a valid OFF file")
diff --git a/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
index c236d992..db34962d 100755
--- a/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
+++ b/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='EuclideanWitnessComplex creation from '
@@ -40,7 +40,7 @@ parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument("-a", "--max_alpha_square", type=float, required=True)
parser.add_argument("-n", "--number_of_landmarks", type=int, required=True)
parser.add_argument("-d", "--limit_dimension", type=int, required=True)
-parser.add_argument("-b", "--band_boot", type=float, default=0.)
+parser.add_argument("-b", "--band", type=float, default=0.)
parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
args = parser.parse_args()
@@ -71,7 +71,7 @@ with open(args.file, 'r') as f:
print(simplex_tree.betti_numbers())
if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band_boot=args.band_boot)
+ pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
pplot.show()
else:
print(args.file, "is not a valid OFF file")
diff --git a/cython/example/gudhi_graphical_tools_example.py b/cython/example/gudhi_graphical_tools_example.py
index ed87806b..ac3d146c 100755
--- a/cython/example/gudhi_graphical_tools_example.py
+++ b/cython/example/gudhi_graphical_tools_example.py
@@ -8,7 +8,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,15 +25,10 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
print("#####################################################################")
-print("Show palette colors values for dimension")
-
-gudhi.show_palette_values()
-
-print("#####################################################################")
print("Show barcode persistence example")
persistence = [(2, (1.0, float('inf'))), (1, (1.4142135623730951, float('inf'))),
@@ -50,5 +45,5 @@ pplot.show()
print("#####################################################################")
print("Show diagram persistence example with a confidence band")
-pplot = gudhi.plot_persistence_diagram(persistence, band_boot=0.2)
+pplot = gudhi.plot_persistence_diagram(persistence, band=0.2)
pplot.show()
diff --git a/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py b/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
index 00334121..5f968bf1 100755
--- a/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
+++ b/cython/example/periodic_cubical_complex_barcode_persistence_from_perseus_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
def is_file_perseus(file):
diff --git a/cython/example/random_cubical_complex_persistence_example.py b/cython/example/random_cubical_complex_persistence_example.py
index c832d6bf..80ff2452 100755
--- a/cython/example/random_cubical_complex_persistence_example.py
+++ b/cython/example/random_cubical_complex_persistence_example.py
@@ -13,7 +13,7 @@ import operator
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -30,7 +30,7 @@ import operator
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='Random cubical complex.',
diff --git a/cython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py b/cython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py
new file mode 100755
index 00000000..0c9dfc43
--- /dev/null
+++ b/cython/example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py
@@ -0,0 +1,84 @@
+#!/usr/bin/env python
+
+import gudhi
+import sys
+import argparse
+
+"""This file is part of the Gudhi Library. The Gudhi library
+ (Geometric Understanding in Higher Dimensions) is a generic C++
+ library for computational topology.
+
+ Author(s): Vincent Rouvreau
+
+ Copyright (C) 2017 Inria
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+"""
+
+__author__ = "Vincent Rouvreau"
+__copyright__ = "Copyright (C) 2017 Inria"
+__license__ = "GPL v3"
+
+parser = argparse.ArgumentParser(description='RipsComplex creation from '
+ 'a correlation matrix read in a csv file.',
+ epilog='Example: '
+ 'example/rips_complex_diagram_persistence_from_correlation_matrix_file_example.py '
+ '-f ../data/correlation_matrix/lower_triangular_correlation_matrix.csv -e 12.0 -d 3'
+ '- Constructs a Rips complex with the '
+ 'correlation matrix from the given csv file.')
+parser.add_argument("-f", "--file", type=str, required=True)
+parser.add_argument("-c", "--min_edge_correlation", type=float, default=0.5)
+parser.add_argument("-d", "--max_dimension", type=int, default=1)
+parser.add_argument("-b", "--band", type=float, default=0.)
+parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
+
+args = parser.parse_args()
+
+if not (-1. < args.min_edge_correlation < 1.):
+ print("Wrong value of the treshold corelation (should be between -1 and 1).")
+ sys.exit(1)
+
+print("#####################################################################")
+print("Caution: as persistence diagrams points will be under the diagonal,")
+print("bottleneck distance and persistence graphical tool will not work")
+print("properly, this is a known issue.")
+
+print("#####################################################################")
+print("RipsComplex creation from correlation matrix read in a csv file")
+
+message = "RipsComplex with min_edge_correlation=" + repr(args.min_edge_correlation)
+print(message)
+
+correlation_matrix = gudhi.read_lower_triangular_matrix_from_csv_file(csv_file=args.file)
+# Given a correlation matrix M, we compute component-wise M'[i,j] = 1-M[i,j] to get a distance matrix:
+distance_matrix = [[1.-correlation_matrix[i][j] for j in range(len(correlation_matrix[i]))] for i in range(len(correlation_matrix))]
+
+rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix,
+ max_edge_length=1.-args.min_edge_correlation)
+simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
+
+message = "Number of simplices=" + repr(simplex_tree.num_simplices())
+print(message)
+
+diag = simplex_tree.persistence()
+
+print("betti_numbers()=")
+print(simplex_tree.betti_numbers())
+
+# invert the persistence diagram
+invert_diag = [(diag[pers][0],(1.-diag[pers][1][0], 1.-diag[pers][1][1])) for pers in range(len(diag))]
+
+if args.no_diagram == False:
+ pplot = gudhi.plot_persistence_diagram(invert_diag, band=args.band)
+ pplot.show()
diff --git a/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py b/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
index 3baebd17..4d2ed577 100755
--- a/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
+++ b/cython/example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,20 +26,20 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='RipsComplex creation from '
- 'a distance matrix read in a OFF file.',
+ 'a distance matrix read in a csv file.',
epilog='Example: '
'example/rips_complex_diagram_persistence_from_distance_matrix_file_example.py '
'-f ../data/distance_matrix/lower_triangular_distance_matrix.csv -e 12.0 -d 3'
'- Constructs a Rips complex with the '
- 'points from the given OFF file.')
+ 'distance matrix from the given csv file.')
parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument("-e", "--max_edge_length", type=float, default=0.5)
parser.add_argument("-d", "--max_dimension", type=int, default=1)
-parser.add_argument("-b", "--band_boot", type=float, default=0.)
+parser.add_argument("-b", "--band", type=float, default=0.)
parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
args = parser.parse_args()
@@ -50,7 +50,8 @@ print("RipsComplex creation from distance matrix read in a csv file")
message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
print(message)
-rips_complex = gudhi.RipsComplex(csv_file=args.file, max_edge_length=args.max_edge_length)
+distance_matrix = gudhi.read_lower_triangular_matrix_from_csv_file(csv_file=args.file)
+rips_complex = gudhi.RipsComplex(distance_matrix=distance_matrix, max_edge_length=args.max_edge_length)
simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
message = "Number of simplices=" + repr(simplex_tree.num_simplices())
@@ -62,5 +63,5 @@ print("betti_numbers()=")
print(simplex_tree.betti_numbers())
if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band_boot=args.band_boot)
+ pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
pplot.show()
diff --git a/cython/example/rips_complex_diagram_persistence_from_off_file_example.py b/cython/example/rips_complex_diagram_persistence_from_off_file_example.py
index 5951eedf..d15d5eb0 100755
--- a/cython/example/rips_complex_diagram_persistence_from_off_file_example.py
+++ b/cython/example/rips_complex_diagram_persistence_from_off_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,7 +26,7 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='RipsComplex creation from '
@@ -39,7 +39,7 @@ parser = argparse.ArgumentParser(description='RipsComplex creation from '
parser.add_argument("-f", "--file", type=str, required=True)
parser.add_argument("-e", "--max_edge_length", type=float, default=0.5)
parser.add_argument("-d", "--max_dimension", type=int, default=1)
-parser.add_argument("-b", "--band_boot", type=float, default=0.)
+parser.add_argument("-b", "--band", type=float, default=0.)
parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
args = parser.parse_args()
@@ -53,7 +53,8 @@ with open(args.file, 'r') as f:
message = "RipsComplex with max_edge_length=" + repr(args.max_edge_length)
print(message)
- rips_complex = gudhi.RipsComplex(off_file=args.file, max_edge_length=args.max_edge_length)
+ point_cloud = gudhi.read_off(off_file=args.file)
+ rips_complex = gudhi.RipsComplex(points=point_cloud, max_edge_length=args.max_edge_length)
simplex_tree = rips_complex.create_simplex_tree(max_dimension=args.max_dimension)
message = "Number of simplices=" + repr(simplex_tree.num_simplices())
@@ -65,7 +66,7 @@ with open(args.file, 'r') as f:
print(simplex_tree.betti_numbers())
if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band_boot=args.band_boot)
+ pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
pplot.show()
else:
print(args.file, "is not a valid OFF file")
diff --git a/cython/example/rips_complex_from_points_example.py b/cython/example/rips_complex_from_points_example.py
index 5d411b1a..ffa9d91f 100755
--- a/cython/example/rips_complex_from_points_example.py
+++ b/cython/example/rips_complex_from_points_example.py
@@ -8,7 +8,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
print("#####################################################################")
diff --git a/cython/example/rips_persistence_diagram.py b/cython/example/rips_persistence_diagram.py
index 9bfea41c..7a6a9f46 100755
--- a/cython/example/rips_persistence_diagram.py
+++ b/cython/example/rips_persistence_diagram.py
@@ -8,7 +8,7 @@ import gudhi
Author(s): Marc Glisse
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ import gudhi
"""
__author__ = "Marc Glisse"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
print("#####################################################################")
diff --git a/cython/example/simplex_tree_example.py b/cython/example/simplex_tree_example.py
index 51a60e73..28679015 100755
--- a/cython/example/simplex_tree_example.py
+++ b/cython/example/simplex_tree_example.py
@@ -8,7 +8,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
print("#####################################################################")
diff --git a/cython/example/tangential_complex_plain_homology_from_off_file_example.py b/cython/example/tangential_complex_plain_homology_from_off_file_example.py
index 6145e7f2..0f8f5e80 100755
--- a/cython/example/tangential_complex_plain_homology_from_off_file_example.py
+++ b/cython/example/tangential_complex_plain_homology_from_off_file_example.py
@@ -9,7 +9,7 @@ import argparse
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -26,18 +26,19 @@ import argparse
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
parser = argparse.ArgumentParser(description='TangentialComplex creation from '
'points read in a OFF file.',
epilog='Example: '
'example/tangential_complex_plain_homology_from_off_file_example.py '
- '-f ../data/points/tore3D_300.off'
+ '-f ../data/points/tore3D_300.off -i 3'
'- Constructs a tangential complex with the '
'points from the given OFF file')
parser.add_argument("-f", "--file", type=str, required=True)
-parser.add_argument("-b", "--band_boot", type=float, default=0.)
+parser.add_argument("-i", "--intrisic_dim", type=int, required=True)
+parser.add_argument("-b", "--band", type=float, default=0.)
parser.add_argument('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams')
args = parser.parse_args()
@@ -48,7 +49,7 @@ with open(args.file, 'r') as f:
print("#####################################################################")
print("TangentialComplex creation from points read in a OFF file")
- tc = gudhi.TangentialComplex(off_file=args.file)
+ tc = gudhi.TangentialComplex(intrisic_dim = args.intrisic_dim, off_file=args.file)
st = tc.create_simplex_tree()
message = "Number of simplices=" + repr(st.num_simplices())
@@ -60,7 +61,7 @@ with open(args.file, 'r') as f:
print(st.betti_numbers())
if args.no_diagram == False:
- pplot = gudhi.plot_persistence_diagram(diag, band_boot=args.band_boot)
+ pplot = gudhi.plot_persistence_diagram(diag, band=args.band)
pplot.show()
else:
print(args.file, "is not a valid OFF file")
diff --git a/cython/example/witness_complex_from_nearest_landmark_table.py b/cython/example/witness_complex_from_nearest_landmark_table.py
index 92ed970b..e6b295ee 100755
--- a/cython/example/witness_complex_from_nearest_landmark_table.py
+++ b/cython/example/witness_complex_from_nearest_landmark_table.py
@@ -8,7 +8,7 @@ from gudhi import StrongWitnessComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@ from gudhi import StrongWitnessComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
print("#####################################################################")
diff --git a/cython/gudhi.pyx.in b/cython/gudhi.pyx.in
index a8dd9f80..b94f2251 100644
--- a/cython/gudhi.pyx.in
+++ b/cython/gudhi.pyx.in
@@ -4,7 +4,7 @@
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -21,7 +21,7 @@
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
__version__ = "@GUDHI_VERSION@"
# This variable is used by doctest to find files
diff --git a/cython/include/Alpha_complex_interface.h b/cython/include/Alpha_complex_interface.h
index d47db71f..8cf527fc 100644
--- a/cython/include/Alpha_complex_interface.h
+++ b/cython/include/Alpha_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Bottleneck_distance_interface.h b/cython/include/Bottleneck_distance_interface.h
index d5fbf6ea..5ad9d77d 100644
--- a/cython/include/Bottleneck_distance_interface.h
+++ b/cython/include/Bottleneck_distance_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Cubical_complex_interface.h b/cython/include/Cubical_complex_interface.h
index fad92c2c..85b717b3 100644
--- a/cython/include/Cubical_complex_interface.h
+++ b/cython/include/Cubical_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Euclidean_strong_witness_complex_interface.h b/cython/include/Euclidean_strong_witness_complex_interface.h
index b9dd8177..d86355d6 100644
--- a/cython/include/Euclidean_strong_witness_complex_interface.h
+++ b/cython/include/Euclidean_strong_witness_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Euclidean_witness_complex_interface.h b/cython/include/Euclidean_witness_complex_interface.h
index 2a09b3b5..dc303533 100644
--- a/cython/include/Euclidean_witness_complex_interface.h
+++ b/cython/include/Euclidean_witness_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Off_reader_interface.h b/cython/include/Off_reader_interface.h
index 0ca55500..f6b14f38 100644
--- a/cython/include/Off_reader_interface.h
+++ b/cython/include/Off_reader_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Persistent_cohomology_interface.h b/cython/include/Persistent_cohomology_interface.h
index 55028fd0..8cf71a4e 100644
--- a/cython/include/Persistent_cohomology_interface.h
+++ b/cython/include/Persistent_cohomology_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -85,6 +85,32 @@ persistent_cohomology::Persistent_cohomology<FilteredComplex, persistent_cohomol
return persistence;
}
+ std::vector<std::pair<std::vector<int>, std::vector<int>>> persistence_pairs() {
+ auto pairs = persistent_cohomology::Persistent_cohomology<FilteredComplex,
+ persistent_cohomology::Field_Zp>::get_persistent_pairs();
+
+ std::vector<std::pair<std::vector<int>, std::vector<int>>> persistence_pairs;
+ persistence_pairs.reserve(pairs.size());
+ for (auto pair : pairs) {
+ std::vector<int> birth;
+ if (get<0>(pair) != stptr_->null_simplex()) {
+ for (auto vertex : stptr_->simplex_vertex_range(get<0>(pair))) {
+ birth.push_back(vertex);
+ }
+ }
+
+ std::vector<int> death;
+ if (get<1>(pair) != stptr_->null_simplex()) {
+ for (auto vertex : stptr_->simplex_vertex_range(get<1>(pair))) {
+ death.push_back(vertex);
+ }
+ }
+
+ persistence_pairs.push_back(std::make_pair(birth, death));
+ }
+ return persistence_pairs;
+ }
+
private:
// A copy
FilteredComplex* stptr_;
diff --git a/cython/include/Reader_utils_interface.h b/cython/include/Reader_utils_interface.h
index 8ec34f61..5f7527d9 100644
--- a/cython/include/Reader_utils_interface.h
+++ b/cython/include/Reader_utils_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2017 INRIA
+ * Copyright (C) 2017 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Rips_complex_interface.h b/cython/include/Rips_complex_interface.h
index 02985727..8b6c9c35 100644
--- a/cython/include/Rips_complex_interface.h
+++ b/cython/include/Rips_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -25,9 +25,7 @@
#include <gudhi/Simplex_tree.h>
#include <gudhi/Rips_complex.h>
-#include <gudhi/Points_off_io.h>
#include <gudhi/distance_functions.h>
-#include <gudhi/reader_utils.h>
#include "Simplex_tree_interface.h"
@@ -56,21 +54,6 @@ class Rips_complex_interface {
}
}
- Rips_complex_interface(const std::string& file_name, double threshold, bool euclidean, bool from_file = true) {
- if (euclidean) {
- // Rips construction where file_name is an OFF file
- Gudhi::Points_off_reader<Point_d> off_reader(file_name);
- rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(off_reader.get_point_cloud(),
- threshold,
- Gudhi::Euclidean_distance());
- } else {
- // Rips construction where values is a distance matrix
- Distance_matrix distances =
- Gudhi::read_lower_triangular_matrix_from_csv_file<Simplex_tree_interface<>::Filtration_value>(file_name);
- rips_complex_ = new Rips_complex<Simplex_tree_interface<>::Filtration_value>(distances, threshold);
- }
- }
-
~Rips_complex_interface() {
delete rips_complex_;
}
diff --git a/cython/include/Simplex_tree_interface.h b/cython/include/Simplex_tree_interface.h
index 54a4f824..3481eeff 100644
--- a/cython/include/Simplex_tree_interface.h
+++ b/cython/include/Simplex_tree_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Strong_witness_complex_interface.h b/cython/include/Strong_witness_complex_interface.h
index d05eaac5..3c72c916 100644
--- a/cython/include/Strong_witness_complex_interface.h
+++ b/cython/include/Strong_witness_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Subsampling_interface.h b/cython/include/Subsampling_interface.h
index b0f4a50a..f990da0c 100644
--- a/cython/include/Subsampling_interface.h
+++ b/cython/include/Subsampling_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/include/Tangential_complex_interface.h b/cython/include/Tangential_complex_interface.h
index 0c3a510e..71418886 100644
--- a/cython/include/Tangential_complex_interface.h
+++ b/cython/include/Tangential_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -45,24 +45,19 @@ class Tangential_complex_interface {
using TC = Tangential_complex<Dynamic_kernel, CGAL::Dynamic_dimension_tag, CGAL::Parallel_tag>;
public:
- Tangential_complex_interface(const std::vector<std::vector<double>>& points) {
+ Tangential_complex_interface(int intrisic_dim, const std::vector<std::vector<double>>& points) {
Dynamic_kernel k;
- unsigned intrisic_dim = 0;
- if (points.size() > 0)
- intrisic_dim = points[0].size() - 1;
tangential_complex_ = new TC(points, intrisic_dim, k);
tangential_complex_->compute_tangential_complex();
num_inconsistencies_ = tangential_complex_->number_of_inconsistent_simplices();
}
- Tangential_complex_interface(const std::string& off_file_name, bool from_file = true) {
- Gudhi::Points_off_reader<Point_d> off_reader(off_file_name);
+ Tangential_complex_interface(int intrisic_dim, const std::string& off_file_name, bool from_file = true) {
Dynamic_kernel k;
- unsigned intrisic_dim = 0;
+
+ Gudhi::Points_off_reader<Point_d> off_reader(off_file_name);
std::vector<Point_d> points = off_reader.get_point_cloud();
- if (points.size() > 0)
- intrisic_dim = points[0].size() - 1;
tangential_complex_ = new TC(points, intrisic_dim, k);
tangential_complex_->compute_tangential_complex();
diff --git a/cython/include/Witness_complex_interface.h b/cython/include/Witness_complex_interface.h
index 6501cc35..01b372e7 100644
--- a/cython/include/Witness_complex_interface.h
+++ b/cython/include/Witness_complex_interface.h
@@ -4,7 +4,7 @@
*
* Author(s): Vincent Rouvreau
*
- * Copyright (C) 2016 INRIA
+ * Copyright (C) 2016 Inria
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
diff --git a/cython/setup.py.in b/cython/setup.py.in
index c767e93d..ee381a1b 100644
--- a/cython/setup.py.in
+++ b/cython/setup.py.in
@@ -7,7 +7,7 @@ from Cython.Build import cythonize
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ from Cython.Build import cythonize
"""
__author__ = "GUDHI Editorial Board"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
gudhi = Extension(
@@ -46,4 +46,9 @@ setup(
version='@GUDHI_VERSION@',
url='http://gudhi.gforge.inria.fr/',
ext_modules = cythonize(gudhi),
+ install_requires = [
+ "matplotlib",
+ "numpy",
+ "cython",
+ ],
)
diff --git a/cython/test/test_alpha_complex.py b/cython/test/test_alpha_complex.py
index 2c76d9d7..e97f2530 100755
--- a/cython/test/test_alpha_complex.py
+++ b/cython/test/test_alpha_complex.py
@@ -6,7 +6,7 @@ from gudhi import AlphaComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import AlphaComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_bottleneck_distance.py b/cython/test/test_bottleneck_distance.py
index 3d982d34..4eb5848f 100755
--- a/cython/test/test_bottleneck_distance.py
+++ b/cython/test/test_bottleneck_distance.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_cubical_complex.py b/cython/test/test_cubical_complex.py
index 0e81554d..92e591e9 100755
--- a/cython/test/test_cubical_complex.py
+++ b/cython/test/test_cubical_complex.py
@@ -6,7 +6,7 @@ from gudhi import CubicalComplex
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import CubicalComplex
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
@@ -72,6 +72,17 @@ def test_dimension_simple_constructor():
assert cub.betti_numbers() == [1, 0, 0]
assert cub.persistent_betti_numbers(0, 1000) == [0, 0, 0]
+def test_user_case_simple_constructor():
+ cub = CubicalComplex(dimensions=[3, 3],
+ top_dimensional_cells = [float('inf'), 0.,0.,0.,1.,0.,0.,0.,0.])
+ assert cub.__is_defined() == True
+ assert cub.__is_persistence_defined() == False
+ assert cub.persistence() == [(1, (0.0, 1.0)), (0, (0.0, float('inf')))]
+ assert cub.__is_persistence_defined() == True
+ other_cub = CubicalComplex(dimensions=[3, 3],
+ top_dimensional_cells = [1000., 0.,0.,0.,1.,0.,0.,0.,0.])
+ assert other_cub.persistence() == [(1, (0.0, 1.0)), (0, (0.0, float('inf')))]
+
def test_dimension_file_constructor():
# Create test file
test_file = open('CubicalOneSphere.txt', 'w')
diff --git a/cython/test/test_euclidean_witness_complex.py b/cython/test/test_euclidean_witness_complex.py
index 737f1ef4..2f77210a 100755
--- a/cython/test/test_euclidean_witness_complex.py
+++ b/cython/test/test_euclidean_witness_complex.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_reader_utils.py b/cython/test/test_reader_utils.py
index 25591fb3..b240c84f 100755
--- a/cython/test/test_reader_utils.py
+++ b/cython/test/test_reader_utils.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2017 INRIA
+ Copyright (C) 2017 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2017 INRIA"
+__copyright__ = "Copyright (C) 2017 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_rips_complex.py b/cython/test/test_rips_complex.py
index c7d2ead4..c37b5400 100755
--- a/cython/test/test_rips_complex.py
+++ b/cython/test/test_rips_complex.py
@@ -7,7 +7,7 @@ from math import sqrt
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,7 +24,7 @@ from math import sqrt
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_simplex_tree.py b/cython/test/test_simplex_tree.py
index 6dec5d94..cb701c9a 100755
--- a/cython/test/test_simplex_tree.py
+++ b/cython/test/test_simplex_tree.py
@@ -6,7 +6,7 @@ from gudhi import SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
@@ -161,3 +161,47 @@ def test_automatic_dimension():
assert st.upper_bound_dimension() == 2
assert st.dimension() == 1
assert st.upper_bound_dimension() == 1
+
+def test_make_filtration_non_decreasing():
+ st = SimplexTree()
+ assert st.__is_defined() == True
+ assert st.__is_persistence_defined() == False
+
+ # Inserted simplex:
+ # 1
+ # o
+ # /X\
+ # o---o---o---o
+ # 2 0 3\X/4
+ # o
+ # 5
+ assert st.insert([2, 1, 0], filtration=2.0) == True
+ assert st.insert([3, 0], filtration=2.0) == True
+ assert st.insert([3, 4, 5], filtration=2.0) == True
+
+ assert st.make_filtration_non_decreasing() == False
+
+ # Because of non decreasing property of simplex tree, { 0 } , { 1 } and
+ # { 0, 1 } are going to be set from value 2.0 to 1.0
+ st.insert([0, 1, 6, 7], filtration=1.0);
+
+ assert st.make_filtration_non_decreasing() == False
+
+ # Modify specific values to test make_filtration_non_decreasing
+ st.assign_filtration([0,1,6,7], 0.8);
+ st.assign_filtration([0,1,6], 0.9);
+ st.assign_filtration([0,6], 0.6);
+ st.assign_filtration([3,4,5], 1.2);
+ st.assign_filtration([3,4], 1.1);
+ st.assign_filtration([4,5], 1.99);
+
+ assert st.make_filtration_non_decreasing() == True
+
+ assert st.filtration([0,1,6,7]) == 1.
+ assert st.filtration([0,1,6]) == 1.
+ assert st.filtration([0,1]) == 1.
+ assert st.filtration([0]) == 1.
+ assert st.filtration([1]) == 1.
+ assert st.filtration([3,4,5]) == 2.
+ assert st.filtration([3,4]) == 2.
+ assert st.filtration([4,5]) == 2.
diff --git a/cython/test/test_subsampling.py b/cython/test/test_subsampling.py
index 2caf4ddb..96906a6f 100755
--- a/cython/test/test_subsampling.py
+++ b/cython/test/test_subsampling.py
@@ -6,7 +6,7 @@ import gudhi
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ import gudhi
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
diff --git a/cython/test/test_tangential_complex.py b/cython/test/test_tangential_complex.py
index 8aa4023c..5385a0d3 100755
--- a/cython/test/test_tangential_complex.py
+++ b/cython/test/test_tangential_complex.py
@@ -6,7 +6,7 @@ from gudhi import TangentialComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,13 +23,13 @@ from gudhi import TangentialComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"
def test_tangential():
point_list = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0], [1.0, 1.0]]
- tc = TangentialComplex(points=point_list)
+ tc = TangentialComplex(intrisic_dim = 1, points=point_list)
assert tc.__is_defined() == True
assert tc.num_vertices() == 4
diff --git a/cython/test/test_witness_complex.py b/cython/test/test_witness_complex.py
index 7d1fb6be..bcbc521b 100755
--- a/cython/test/test_witness_complex.py
+++ b/cython/test/test_witness_complex.py
@@ -6,7 +6,7 @@ from gudhi import WitnessComplex, StrongWitnessComplex, SimplexTree
Author(s): Vincent Rouvreau
- Copyright (C) 2016 INRIA
+ Copyright (C) 2016 Inria
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@ from gudhi import WitnessComplex, StrongWitnessComplex, SimplexTree
"""
__author__ = "Vincent Rouvreau"
-__copyright__ = "Copyright (C) 2016 INRIA"
+__copyright__ = "Copyright (C) 2016 Inria"
__license__ = "GPL v3"