From 6d66260b62aa5c780e3ac2f0f191992aca016e24 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Thu, 9 Mar 2017 10:22:37 +0000 Subject: Strong witness cythonization Biblio for doc simplification git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2184 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: c191c6b79bb14f799d6cd08ac59a6b007a7874dc --- .../include/Strong_witness_complex_interface.h | 71 ++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 src/cython/include/Strong_witness_complex_interface.h (limited to 'src/cython/include/Strong_witness_complex_interface.h') diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h new file mode 100644 index 00000000..e59e58ea --- /dev/null +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -0,0 +1,71 @@ +/* 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) 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 + * 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 . + */ + +#ifndef STRONG_WITNESS_COMPLEX_INTERFACE_H +#define STRONG_WITNESS_COMPLEX_INTERFACE_H + +#include +#include + +#include "Simplex_tree_interface.h" + +#include +#include // std::pair +#include +#include + +namespace Gudhi { + +namespace witness_complex { + +class Strong_witness_complex_interface { + using Nearest_landmark_range = std::vector>; + using Nearest_landmark_table = std::vector; + + public: + Strong_witness_complex_interface(Nearest_landmark_table& nlt) { + witness_complex_ = new Strong_witness_complex(nlt); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, + std::size_t limit_dimension) { + witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); + simplex_tree->initialize_filtration(); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, + double max_alpha_square) { + witness_complex_->create_complex(*simplex_tree, max_alpha_square, std::numeric_limits::max()); + simplex_tree->initialize_filtration(); + } + + private: + Strong_witness_complex* witness_complex_; + +}; + +} // namespace witness_complex + +} // namespace Gudhi + +#endif // STRONG_WITNESS_COMPLEX_INTERFACE_H + -- cgit v1.2.3 From af46c40bec8ae03cdf5a1e5a37ede198f910e3ea Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 14 Mar 2017 22:08:43 +0000 Subject: Add Windows and CGAL_HEADER_ONLY cythonization support Add OFF reader interfaces (required by Euclidean witness complex) Add Euclidean_witness_complex git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2186 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 4d780f05c3409bea47a81e4377dbaf509b9e718c --- src/cython/CMakeLists.txt | 52 +++++++++- src/cython/cython/euclidean_witness_complex.pyx | 84 +++++++++++++++ src/cython/cython/off_reader.pyx | 49 +++++++++ ...ex_diagram_persistence_from_off_file_example.py | 78 ++++++++++++++ .../example/witness_complex_from_file_example.py | 56 ---------- src/cython/gudhi.pyx.in | 2 + .../include/Euclidean_witness_complex_interface.h | 113 +++++++++++++++++++++ src/cython/include/Off_reader_interface.h | 42 ++++++++ .../include/Strong_witness_complex_interface.h | 2 +- src/cython/include/Witness_complex_interface.h | 2 +- src/cython/test/test_euclidean_witness_complex.py | 39 +++++++ src/cython/test/test_witness_complex.py | 51 ++++++---- 12 files changed, 485 insertions(+), 85 deletions(-) create mode 100644 src/cython/cython/euclidean_witness_complex.pyx create mode 100644 src/cython/cython/off_reader.pyx create mode 100755 src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py delete mode 100755 src/cython/example/witness_complex_from_file_example.py create mode 100644 src/cython/include/Euclidean_witness_complex_interface.h create mode 100644 src/cython/include/Off_reader_interface.h create mode 100755 src/cython/test/test_euclidean_witness_complex.py (limited to 'src/cython/include/Strong_witness_complex_interface.h') diff --git a/src/cython/CMakeLists.txt b/src/cython/CMakeLists.txt index bcc1e929..efe2005c 100644 --- a/src/cython/CMakeLists.txt +++ b/src/cython/CMakeLists.txt @@ -1,6 +1,19 @@ cmake_minimum_required(VERSION 2.8) project(Cython) +macro( find_the_lib placeholder THE_LIBS ) + set (THE_LIB_WE_FOUND "NO") + foreach(THE_LIB ${THE_LIBS}) + if(EXISTS ${THE_LIB}) + get_filename_component(THE_LIB_WE ${THE_LIB} NAME_WE) + if (NOT THE_LIB_WE_FOUND) + set (THE_LIB_WE_FOUND "YES") + set(returnValue "${THE_LIB_WE}") + endif(NOT THE_LIB_WE_FOUND) + endif(EXISTS ${THE_LIB}) + endforeach(THE_LIB ${THE_LIBS}) +endmacro( find_the_lib ) + FIND_PROGRAM( PYTHON_PATH python ) FIND_PROGRAM( CYTHON_PATH cython ) @@ -13,8 +26,15 @@ if(PYTHON_PATH AND CYTHON_PATH) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_RESULT_OF_USE_DECLTYPE', ") set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DBOOST_ALL_NO_LIB', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'boost_system', ") set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${Boost_LIBRARY_DIRS}', ") + if(WIN32) + set( returnValue "" ) + find_the_lib (${returnValue} ${Boost_SYSTEM_LIBRARY}) + set(BOOST_SYSTEM_LIB_NAME ${returnValue}) + else() + set(BOOST_SYSTEM_LIB_NAME "boost_system") + endif() + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'${BOOST_SYSTEM_LIB_NAME}', ") # Gudhi and CGAL compilation option if(MSVC) @@ -105,16 +125,38 @@ if(PYTHON_PATH AND CYTHON_PATH) file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_sum.rst") file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/alpha_complex_user.rst") endif (NOT CGAL_VERSION VERSION_LESS 4.7.0) + if (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # If CGAL_VERSION >= 4.6.0, include euclidean versions of witness complex + set(GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX + "include 'cython/euclidean_witness_complex.pyx'\n") + else (NOT CGAL_VERSION VERSION_LESS 4.6.0) + # Remove alpha complex unitary tests + file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/test/test_euclidean_witness_complex.py) + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_witness_complex_ref.rst") + file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/doc/euclidean_strong_witness_complex_ref.rst") + endif (NOT CGAL_VERSION VERSION_LESS 4.6.0) if(CGAL_FOUND) # Add CGAL compilation args - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") + if(CGAL_HEADER_ONLY) + set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_HEADER_ONLY', ") + else(CGAL_HEADER_ONLY) + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL-vc140-mt-4.7', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'CGAL', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${CGAL_LIBRARIES_DIR}', ") + endif(CGAL_HEADER_ONLY) # GMP and GMPXX are not required, but if present, CGAL will link with them. if(GMP_FOUND) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMP', ") - set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") - set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") + if(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'libgmp-10', ") + else(WIN32) + set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmp', ") + endif(WIN32) + set(GUDHI_CYTHON_LIBRARY_DIRS "${GUDHI_CYTHON_LIBRARY_DIRS}'${GMP_LIBRARIES_DIR}', ") if(GMPXX_FOUND) set(GUDHI_CYTHON_EXTRA_COMPILE_ARGS "${GUDHI_CYTHON_EXTRA_COMPILE_ARGS}'-DCGAL_USE_GMPXX', ") set(GUDHI_CYTHON_LIBRARIES "${GUDHI_CYTHON_LIBRARIES}'gmpxx', ") diff --git a/src/cython/cython/euclidean_witness_complex.pyx b/src/cython/cython/euclidean_witness_complex.pyx new file mode 100644 index 00000000..efbbf06d --- /dev/null +++ b/src/cython/cython/euclidean_witness_complex.pyx @@ -0,0 +1,84 @@ +from cython cimport numeric +from libcpp.vector cimport vector +from libcpp.utility cimport pair + +"""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) 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 + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + +cdef extern from "Euclidean_witness_complex_interface.h" namespace "Gudhi": + cdef cppclass Euclidean_witness_complex_interface "Gudhi::witness_complex::Euclidean_witness_complex_interface": + Euclidean_witness_complex_interface(vector[vector[double]] landmarks, vector[vector[double]] witnesses) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square) + void create_simplex_tree(Simplex_tree_interface_full_featured* simplex_tree, double max_alpha_square, + unsigned limit_dimension) + +# EuclideanWitnessComplex python interface +cdef class EuclideanWitnessComplex: + """EuclideanWitnessComplex is a simplicial complex constructed from ... + + """ + + cdef Euclidean_witness_complex_interface * thisptr + + # Fake constructor that does nothing but documenting the constructor + def __init__(self, landmarks=None, witnesses=None): + """WitnessComplex constructor. + + :param landmarks: A list of landmarks (in the point cloud). + :type landmarks: list of list of double + + :param witnesses: The point cloud. + :type witnesses: list of list of double + """ + + # The real cython constructor + def __cinit__(self, landmarks=None, witnesses=None): + if landmarks is not None and witnesses is not None: + self.thisptr = new Euclidean_witness_complex_interface(landmarks, witnesses) + + def __dealloc__(self): + if self.thisptr != NULL: + del self.thisptr + + def __is_defined(self): + """Returns true if WitnessComplex pointer is not NULL. + """ + return self.thisptr != NULL + + def create_simplex_tree(self, max_alpha_square, limit_dimension = -1): + """ + :param max_alpha_square: The maximum alpha square threshold the + simplices shall not exceed. Default is set to infinity. + :type max_alpha_square: float + :returns: A simplex tree created from the Delaunay Triangulation. + :rtype: SimplexTree + """ + simplex_tree = SimplexTree() + if limit_dimension is not -1: + self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square, limit_dimension) + else: + self.thisptr.create_simplex_tree(simplex_tree.thisptr, max_alpha_square) + return simplex_tree diff --git a/src/cython/cython/off_reader.pyx b/src/cython/cython/off_reader.pyx new file mode 100644 index 00000000..78c37969 --- /dev/null +++ b/src/cython/cython/off_reader.pyx @@ -0,0 +1,49 @@ +from cython cimport numeric +from libcpp.vector cimport vector +from libcpp.string cimport string +import os + +"""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) 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 + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + +cdef extern from "Off_reader_interface.h" namespace "Gudhi": + vector[vector[double]] read_points_from_OFF_file(string off_file) + +def read_off(off_file=''): + """Read points from OFF file. + + :param off_file: An OFF file style name. + :type off_file: string + + :returns: The point set. + :rtype: vector[vector[double]] + """ + if off_file is not '': + if os.path.isfile(off_file): + return read_points_from_OFF_file(off_file) + else: + print("file " + off_file + " not found.") + diff --git a/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py new file mode 100755 index 00000000..7f04a98e --- /dev/null +++ b/src/cython/example/euclidean_witness_complex_diagram_persistence_from_off_file_example.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python + +import gudhi +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) 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 + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + +parser = argparse.ArgumentParser(description='EuclideanWitnessComplex creation from ' + 'points read in a OFF file.', + epilog='Example: ' + 'example/witness_complex_diagram_persistence_from_off_file_example.py ' + '-f ../data/points/tore3D_300.off -a 1.0 -n 20 -d 2' + '- Constructs a alpha complex with the ' + 'points from the given OFF file.') +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('--no-diagram', default=False, action='store_true' , help='Flag for not to display the diagrams') + +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'): + print("#####################################################################") + print("EuclideanWitnessComplex creation from points read in a OFF file") + + witnesses = gudhi.read_off(off_file=args.file) + landmarks = gudhi.pick_n_random_points(points=witnesses, nb_points=args.number_of_landmarks) + + message = "EuclideanWitnessComplex with max_edge_length=" + repr(args.max_alpha_square) + \ + " - Number of landmarks=" + repr(args.number_of_landmarks) + print(message) + + witness_complex = gudhi.EuclideanWitnessComplex(witnesses=witnesses, landmarks=landmarks) + simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=args.max_alpha_square, + limit_dimension=args.limit_dimension) + + message = "Number of simplices=" + repr(simplex_tree.num_simplices()) + print(message) + + diag = simplex_tree.persistence() + + print("betti_numbers()=") + print(simplex_tree.betti_numbers()) + + if args.no_diagram == False: + gudhi.diagram_persistence(diag) + + else: + print(args.file, "is not a valid OFF file") + + f.close() diff --git a/src/cython/example/witness_complex_from_file_example.py b/src/cython/example/witness_complex_from_file_example.py deleted file mode 100755 index 82a5b49a..00000000 --- a/src/cython/example/witness_complex_from_file_example.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -import gudhi -import pandas -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) 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 - 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 . -""" - -__author__ = "Vincent Rouvreau" -__copyright__ = "Copyright (C) 2016 INRIA" -__license__ = "GPL v3" - -print("#####################################################################") -print("WitnessComplex creation from points read in a file") - -parser = argparse.ArgumentParser(description='WitnessComplex creation from ' - 'points read in a file.', - epilog='Example: ' - 'example/witness_complex_from_file_example.py' - ' data/2000_random_points_on_3D_Torus.csv ' - '- Constructs a witness complex with the ' - 'points from the given file. File format ' - 'is X1, X2, ..., Xn') -parser.add_argument('file', type=argparse.FileType('r')) -args = parser.parse_args() - -points = pandas.read_csv(args.file, header=None) - -print("WitnessComplex with number_of_landmarks=100") - -witness_complex = gudhi.WitnessComplex(points=points.values, - number_of_landmarks=100) - -witness_complex.initialize_filtration() - -print("filtered_tree=", witness_complex.get_filtered_tree()) diff --git a/src/cython/gudhi.pyx.in b/src/cython/gudhi.pyx.in index 60bf0cd7..34d7c3b5 100644 --- a/src/cython/gudhi.pyx.in +++ b/src/cython/gudhi.pyx.in @@ -24,6 +24,7 @@ __author__ = "Vincent Rouvreau" __copyright__ = "Copyright (C) 2016 INRIA" __license__ = "GPL v3" +include "cython/off_reader.pyx" include "cython/simplex_tree.pyx" include "cython/rips_complex.pyx" include "cython/cubical_complex.pyx" @@ -32,6 +33,7 @@ include "cython/persistence_graphical_tools.py" include "cython/witness_complex.pyx" include "cython/strong_witness_complex.pyx" @GUDHI_CYTHON_ALPHA_COMPLEX@ +@GUDHI_CYTHON_EUCLIDEAN_WITNESS_COMPLEX@ @GUDHI_CYTHON_SUBSAMPLING@ @GUDHI_CYTHON_TANGENTIAL_COMPLEX@ @GUDHI_CYTHON_BOTTLENECK_DISTANCE@ diff --git a/src/cython/include/Euclidean_witness_complex_interface.h b/src/cython/include/Euclidean_witness_complex_interface.h new file mode 100644 index 00000000..f79d93ab --- /dev/null +++ b/src/cython/include/Euclidean_witness_complex_interface.h @@ -0,0 +1,113 @@ +/* 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) 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 + * 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 . + */ + +#ifndef EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H +#define EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H + +#include +#include + +#include "Simplex_tree_interface.h" + +#include + +#include +#include // std::pair +#include +#include + +namespace Gudhi { + +namespace witness_complex { + + +class Euclidean_witness_complex_interface { + using Dynamic_kernel = CGAL::Epick_d< CGAL::Dynamic_dimension_tag >; + using Point_d = Dynamic_kernel::Point_d; + + typedef typename Simplex_tree<>::Simplex_key Simplex_key; + + public: + Euclidean_witness_complex_interface(std::vector>&landmarks, std::vector>&witnesses) + : landmarks_(landmarks.begin(), landmarks.end()), + witnesses_(witnesses.begin(), witnesses.end()), + witness_complex_(landmarks_, witnesses_) { + } + Euclidean_witness_complex_interface(std::vector&landmarks, std::vector&witnesses) + : landmarks_(landmarks.begin(), landmarks.end()), + witnesses_(witnesses.begin(), witnesses.end()), + witness_complex_(landmarks_, witnesses_) { + } + + void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { + witness_complex_.create_complex(*simplex_tree, max_alpha_square, limit_dimension); + simplex_tree->initialize_filtration(); + } + + void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square) { + witness_complex_.create_complex(*simplex_tree, max_alpha_square); + simplex_tree->initialize_filtration(); + } + + private: + std::vector landmarks_; + std::vector witnesses_; + Euclidean_witness_complex witness_complex_; +}; + +/*template> +class Euclidean_witness_complex_interface : public Euclidean_witness_complex { +//class Euclidean_witness_complex_interface { + using Point_d = Kernel::Point_d; + + public: + Euclidean_witness_complex_interface(const std::vector>& landmarks, const std::vector>& witnesses) { + : landmarks_(std::begin(landmarks), std::end(landmarks)), + witnesses_(std::begin(witnesses), std::end(witnesses)), + Gudhi::witness_complex::Euclidean_witness_complex(landmarks_, witnesses_) { + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, + std::size_t limit_dimension) { + create_complex(*simplex_tree, max_alpha_square, limit_dimension); + simplex_tree->initialize_filtration(); + } + + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, + double max_alpha_square) { + create_complex(*simplex_tree, max_alpha_square); + simplex_tree->initialize_filtration(); + } + + private: +// Euclidean_witness_complex* witness_complex_; + std::vector landmarks_; + std::vector witnesses_; + +};*/ + +} // namespace witness_complex + +} // namespace Gudhi + +#endif // EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H + diff --git a/src/cython/include/Off_reader_interface.h b/src/cython/include/Off_reader_interface.h new file mode 100644 index 00000000..257331f8 --- /dev/null +++ b/src/cython/include/Off_reader_interface.h @@ -0,0 +1,42 @@ +/* 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) 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 + * 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 . + */ + +#ifndef OFF_READER_INTERFACE_H +#define OFF_READER_INTERFACE_H + +#include + +#include +#include +#include + +namespace Gudhi { + +std::vector> read_points_from_OFF_file(std::string& off_file) { + Gudhi::Points_off_reader> off_reader(off_file); + return off_reader.get_point_cloud(); +} + +} // namespace Gudhi + +#endif // OFF_READER_INTERFACE_H + diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h index e59e58ea..5081ec2d 100644 --- a/src/cython/include/Strong_witness_complex_interface.h +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -54,7 +54,7 @@ class Strong_witness_complex_interface { void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square) { - witness_complex_->create_complex(*simplex_tree, max_alpha_square, std::numeric_limits::max()); + witness_complex_->create_complex(*simplex_tree, max_alpha_square); simplex_tree->initialize_filtration(); } diff --git a/src/cython/include/Witness_complex_interface.h b/src/cython/include/Witness_complex_interface.h index 38661cb6..3761b43d 100644 --- a/src/cython/include/Witness_complex_interface.h +++ b/src/cython/include/Witness_complex_interface.h @@ -54,7 +54,7 @@ class Witness_complex_interface { void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square) { - witness_complex_->create_complex(*simplex_tree, max_alpha_square, std::numeric_limits::max()); + witness_complex_->create_complex(*simplex_tree, max_alpha_square); simplex_tree->initialize_filtration(); } diff --git a/src/cython/test/test_euclidean_witness_complex.py b/src/cython/test/test_euclidean_witness_complex.py new file mode 100755 index 00000000..cb150b7e --- /dev/null +++ b/src/cython/test/test_euclidean_witness_complex.py @@ -0,0 +1,39 @@ +import gudhi + +"""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) 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 + 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 . +""" + +__author__ = "Vincent Rouvreau" +__copyright__ = "Copyright (C) 2016 INRIA" +__license__ = "GPL v3" + + +def test_empty_euclidean_witness_complex(): + euclidean_witness = gudhi.EuclideanWitnessComplex() + assert euclidean_witness.__is_defined() == False + +def test_witness_complex(): + point_cloud = [[1.0, 1.0], [7.0, 0.0], [4.0, 6.0], [9.0, 6.0], + [0.0, 14.0], [2.0, 19.0], [9.0, 17.0]] + landmarks = gudhi.pick_n_random_points(points=point_cloud,nb_points=3) + euclidean_witness_complex = gudhi.EuclideanWitnessComplex(landmarks=landmarks, witnesses = point_cloud) + simplex_tree = euclidean_witness_complex.create_simplex_tree(max_alpha_square=4.1) diff --git a/src/cython/test/test_witness_complex.py b/src/cython/test/test_witness_complex.py index a55e80d7..7d1fb6be 100755 --- a/src/cython/test/test_witness_complex.py +++ b/src/cython/test/test_witness_complex.py @@ -1,4 +1,4 @@ -from gudhi import WitnessComplex +from gudhi import WitnessComplex, StrongWitnessComplex, SimplexTree """This file is part of the Gudhi Library. The Gudhi library (Geometric Understanding in Higher Dimensions) is a generic C++ @@ -32,24 +32,31 @@ def test_empty_witness_complex(): assert witness.__is_defined() == False def test_witness_complex(): - point_list = [[0, 0], [1, 0], [0, 1], [1, 1]] - witness = WitnessComplex(points=point_list, number_of_landmarks=10) - assert witness.__is_defined() == True - - # FIXME: Remove this line - witness.set_dimension(2) - - assert witness.num_simplices() == 13 - assert witness.num_vertices() == 10 - witness.initialize_filtration() -""" - assert witness.get_filtered_tree() == \ - [([0], 0.0), ([1], 0.0), ([0, 1], 0.0), ([2], 0.0), ([1, 2], 0.0), - ([3], 0.0), ([2, 3], 0.0), ([4], 0.0), ([5], 0.0), ([6], 0.0), - ([7], 0.0), ([8], 0.0), ([9], 0.0)] - - - assert witness.get_coface_tree([2], 1) == [([1, 2], 0.0), ([2, 3], 0.0)] - assert witness.get_star_tree([2]) == \ - [([1, 2], 0.0), ([2], 0.0), ([2, 3], 0.0)] -""" + nearest_landmark_table = [[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]], + [[1, 0], [2, 1], [3, 2], [4, 3], [0, 4]], + [[2, 0], [3, 1], [4, 2], [0, 3], [1, 4]], + [[3, 0], [4, 1], [0, 2], [1, 3], [2, 4]], + [[4, 0], [0, 1], [1, 2], [2, 3], [3, 4]]] + + witness_complex = WitnessComplex(nearest_landmark_table=nearest_landmark_table) + simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=4.1) + assert simplex_tree.num_vertices() == 5 + assert simplex_tree.num_simplices() == 31 + simplex_tree = witness_complex.create_simplex_tree(max_alpha_square=4.1, limit_dimension=2) + assert simplex_tree.num_vertices() == 5 + assert simplex_tree.num_simplices() == 25 + +def test_strong_witness_complex(): + nearest_landmark_table = [[[0, 0], [1, 1], [2, 2], [3, 3], [4, 4]], + [[1, 0], [2, 1], [3, 2], [4, 3], [0, 4]], + [[2, 0], [3, 1], [4, 2], [0, 3], [1, 4]], + [[3, 0], [4, 1], [0, 2], [1, 3], [2, 4]], + [[4, 0], [0, 1], [1, 2], [2, 3], [3, 4]]] + + strong_witness_complex = StrongWitnessComplex(nearest_landmark_table=nearest_landmark_table) + simplex_tree = strong_witness_complex.create_simplex_tree(max_alpha_square=4.1) + assert simplex_tree.num_vertices() == 5 + assert simplex_tree.num_simplices() == 31 + simplex_tree = strong_witness_complex.create_simplex_tree(max_alpha_square=4.1, limit_dimension=2) + assert simplex_tree.num_vertices() == 5 + assert simplex_tree.num_simplices() == 25 -- cgit v1.2.3 From 10411aae9845d28d36a9d4394bd668ed84d540f1 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Mon, 20 Mar 2017 13:44:20 +0000 Subject: constify interfaces git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2203 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 55cf020d2a7989dc4e7125bcf6f91443aad4dda1 --- src/cython/include/Alpha_complex_interface.h | 4 ++-- src/cython/include/Bottleneck_distance_interface.h | 8 ++++---- .../Euclidean_strong_witness_complex_interface.h | 6 ++++-- .../include/Euclidean_witness_complex_interface.h | 3 ++- src/cython/include/Off_reader_interface.h | 2 +- src/cython/include/Rips_complex_interface.h | 4 ++-- .../include/Strong_witness_complex_interface.h | 2 +- src/cython/include/Subsampling_interface.h | 24 ++++++++++++++-------- src/cython/include/Tangential_complex_interface.h | 4 ++-- src/cython/include/Witness_complex_interface.h | 2 +- 10 files changed, 35 insertions(+), 24 deletions(-) (limited to 'src/cython/include/Strong_witness_complex_interface.h') diff --git a/src/cython/include/Alpha_complex_interface.h b/src/cython/include/Alpha_complex_interface.h index bcd2849b..f11a464b 100644 --- a/src/cython/include/Alpha_complex_interface.h +++ b/src/cython/include/Alpha_complex_interface.h @@ -42,11 +42,11 @@ class Alpha_complex_interface { using Point_d = Dynamic_kernel::Point_d; public: - Alpha_complex_interface(std::vector>&points) { + Alpha_complex_interface(const std::vector>& points) { alpha_complex_ = new Alpha_complex(points); } - Alpha_complex_interface(std::string off_file_name, bool from_file = true) { + Alpha_complex_interface(const std::string& off_file_name, bool from_file = true) { alpha_complex_ = new Alpha_complex(off_file_name); } diff --git a/src/cython/include/Bottleneck_distance_interface.h b/src/cython/include/Bottleneck_distance_interface.h index b814661e..6819734b 100644 --- a/src/cython/include/Bottleneck_distance_interface.h +++ b/src/cython/include/Bottleneck_distance_interface.h @@ -34,14 +34,14 @@ namespace Gudhi { namespace persistence_diagram { // bottleneck_distance function renamed for the python function can be called bottleneck_dstance - double bottleneck(const std::vector> &diag1, - const std::vector> &diag2, + double bottleneck(const std::vector>& diag1, + const std::vector>& diag2, double e) { return bottleneck_distance(diag1, diag2, e); } - double bottleneck(const std::vector> &diag1, - const std::vector> &diag2) { + double bottleneck(const std::vector>& diag1, + const std::vector>& diag2) { return bottleneck_distance(diag1, diag2); } diff --git a/src/cython/include/Euclidean_strong_witness_complex_interface.h b/src/cython/include/Euclidean_strong_witness_complex_interface.h index 739014b9..fc88a82d 100644 --- a/src/cython/include/Euclidean_strong_witness_complex_interface.h +++ b/src/cython/include/Euclidean_strong_witness_complex_interface.h @@ -47,13 +47,15 @@ class Euclidean_strong_witness_complex_interface { typedef typename Simplex_tree<>::Simplex_key Simplex_key; public: - Euclidean_strong_witness_complex_interface(std::vector>&landmarks, std::vector>&witnesses) + Euclidean_strong_witness_complex_interface(const std::vector>& landmarks, + const std::vector>& witnesses) : landmarks_(landmarks.begin(), landmarks.end()), witnesses_(witnesses.begin(), witnesses.end()), witness_complex_(landmarks_, witnesses_) { } - void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { + void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, + std::size_t limit_dimension) { witness_complex_.create_complex(*simplex_tree, max_alpha_square, limit_dimension); simplex_tree->initialize_filtration(); } diff --git a/src/cython/include/Euclidean_witness_complex_interface.h b/src/cython/include/Euclidean_witness_complex_interface.h index efa8885f..a1ec68aa 100644 --- a/src/cython/include/Euclidean_witness_complex_interface.h +++ b/src/cython/include/Euclidean_witness_complex_interface.h @@ -47,7 +47,8 @@ class Euclidean_witness_complex_interface { typedef typename Simplex_tree<>::Simplex_key Simplex_key; public: - Euclidean_witness_complex_interface(std::vector>&landmarks, std::vector>&witnesses) + Euclidean_witness_complex_interface(const std::vector>& landmarks, + const std::vector>& witnesses) : landmarks_(landmarks.begin(), landmarks.end()), witnesses_(witnesses.begin(), witnesses.end()), witness_complex_(landmarks_, witnesses_) { diff --git a/src/cython/include/Off_reader_interface.h b/src/cython/include/Off_reader_interface.h index 257331f8..97d64d3e 100644 --- a/src/cython/include/Off_reader_interface.h +++ b/src/cython/include/Off_reader_interface.h @@ -31,7 +31,7 @@ namespace Gudhi { -std::vector> read_points_from_OFF_file(std::string& off_file) { +std::vector> read_points_from_OFF_file(const std::string& off_file) { Gudhi::Points_off_reader> off_reader(off_file); return off_reader.get_point_cloud(); } diff --git a/src/cython/include/Rips_complex_interface.h b/src/cython/include/Rips_complex_interface.h index 9295906c..01df5366 100644 --- a/src/cython/include/Rips_complex_interface.h +++ b/src/cython/include/Rips_complex_interface.h @@ -45,7 +45,7 @@ class Rips_complex_interface { using Distance_matrix = std::vector::Filtration_value>>; public: - Rips_complex_interface(std::vector>&values, double threshold, bool euclidean) { + Rips_complex_interface(const std::vector>& values, double threshold, bool euclidean) { if (euclidean) { // Rips construction where values is a vector of points rips_complex_ = new Rips_complex::Filtration_value>(values, threshold, @@ -57,7 +57,7 @@ class Rips_complex_interface { } } - Rips_complex_interface(std::string file_name, double threshold, bool euclidean, bool from_file = true) { + 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 off_reader(file_name); diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h index 5081ec2d..70e78a2a 100644 --- a/src/cython/include/Strong_witness_complex_interface.h +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -42,7 +42,7 @@ class Strong_witness_complex_interface { using Nearest_landmark_table = std::vector; public: - Strong_witness_complex_interface(Nearest_landmark_table& nlt) { + Strong_witness_complex_interface(const Nearest_landmark_table& nlt) { witness_complex_ = new Strong_witness_complex(nlt); } diff --git a/src/cython/include/Subsampling_interface.h b/src/cython/include/Subsampling_interface.h index fb047441..5fc16767 100644 --- a/src/cython/include/Subsampling_interface.h +++ b/src/cython/include/Subsampling_interface.h @@ -42,7 +42,8 @@ using Subsampling_point_d = Subsampling_dynamic_kernel::Point_d; using Subsampling_ft = Subsampling_dynamic_kernel::FT; // ------ choose_n_farthest_points ------ -std::vector> subsampling_n_farthest_points(std::vector>& points, unsigned nb_points) { +std::vector> subsampling_n_farthest_points(const std::vector>& points, + unsigned nb_points) { std::vector> landmarks; Subsampling_dynamic_kernel k; choose_n_farthest_points(k, points, nb_points, std::back_inserter(landmarks)); @@ -50,7 +51,8 @@ std::vector> subsampling_n_farthest_points(std::vector> subsampling_n_farthest_points(std::vector>& points, unsigned nb_points, unsigned starting_point) { +std::vector> subsampling_n_farthest_points(const std::vector>& points, + unsigned nb_points, unsigned starting_point) { std::vector> landmarks; Subsampling_dynamic_kernel k; choose_n_farthest_points(k, points, nb_points, starting_point, std::back_inserter(landmarks)); @@ -58,34 +60,39 @@ std::vector> subsampling_n_farthest_points(std::vector> subsampling_n_farthest_points_from_file(std::string& off_file, unsigned nb_points) { +std::vector> subsampling_n_farthest_points_from_file(const std::string& off_file, + unsigned nb_points) { Gudhi::Points_off_reader> off_reader(off_file); std::vector> points = off_reader.get_point_cloud(); return subsampling_n_farthest_points(points, nb_points); } -std::vector> subsampling_n_farthest_points_from_file(std::string& off_file, unsigned nb_points, unsigned starting_point) { +std::vector> subsampling_n_farthest_points_from_file(const std::string& off_file, + unsigned nb_points, unsigned starting_point) { Gudhi::Points_off_reader> off_reader(off_file); std::vector> points = off_reader.get_point_cloud(); return subsampling_n_farthest_points(points, nb_points, starting_point); } // ------ pick_n_random_points ------ -std::vector> subsampling_n_random_points(std::vector>& points, unsigned nb_points) { +std::vector> subsampling_n_random_points(const std::vector>& points, + unsigned nb_points) { std::vector> landmarks; pick_n_random_points(points, nb_points, std::back_inserter(landmarks)); return landmarks; } -std::vector> subsampling_n_random_points_from_file(std::string& off_file, unsigned nb_points) { +std::vector> subsampling_n_random_points_from_file(const std::string& off_file, + unsigned nb_points) { Gudhi::Points_off_reader> off_reader(off_file); std::vector> points = off_reader.get_point_cloud(); return subsampling_n_random_points(points, nb_points); } // ------ sparsify_point_set ------ -std::vector> subsampling_sparsify_points(std::vector>& points, double min_squared_dist) { +std::vector> subsampling_sparsify_points(const std::vector>& points, + double min_squared_dist) { std::vector input, output; for (auto point : points) input.push_back(Subsampling_point_d(point.size(), point.begin(), point.end())); @@ -98,7 +105,8 @@ std::vector> subsampling_sparsify_points(std::vector> subsampling_sparsify_points_from_file(std::string& off_file, double min_squared_dist) { +std::vector> subsampling_sparsify_points_from_file(const std::string& off_file, + double min_squared_dist) { Gudhi::Points_off_reader> off_reader(off_file); std::vector> points = off_reader.get_point_cloud(); return subsampling_sparsify_points(points, min_squared_dist); diff --git a/src/cython/include/Tangential_complex_interface.h b/src/cython/include/Tangential_complex_interface.h index 7c774c73..93d9bad7 100644 --- a/src/cython/include/Tangential_complex_interface.h +++ b/src/cython/include/Tangential_complex_interface.h @@ -44,7 +44,7 @@ class Tangential_complex_interface { using TC = Tangential_complex; public: - Tangential_complex_interface(std::vector>&points) { + Tangential_complex_interface(const std::vector>& points) { Dynamic_kernel k; unsigned intrisic_dim = 0; if (points.size() > 0) @@ -55,7 +55,7 @@ class Tangential_complex_interface { num_inconsistencies_ = tangential_complex_->number_of_inconsistent_simplices(); } - Tangential_complex_interface(std::string off_file_name, bool from_file = true) { + Tangential_complex_interface(const std::string& off_file_name, bool from_file = true) { Gudhi::Points_off_reader off_reader(off_file_name); Dynamic_kernel k; unsigned intrisic_dim = 0; diff --git a/src/cython/include/Witness_complex_interface.h b/src/cython/include/Witness_complex_interface.h index 3761b43d..835b69ab 100644 --- a/src/cython/include/Witness_complex_interface.h +++ b/src/cython/include/Witness_complex_interface.h @@ -42,7 +42,7 @@ class Witness_complex_interface { using Nearest_landmark_table = std::vector; public: - Witness_complex_interface(Nearest_landmark_table& nlt) { + Witness_complex_interface(const Nearest_landmark_table& nlt) { witness_complex_ = new Witness_complex(nlt); } -- cgit v1.2.3 From 54ed7a649fd461880693f5e9985dc529ae72a39f Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Tue, 21 Mar 2017 13:45:53 +0000 Subject: Memory leaks Landmarks initialization were not correct git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/ST_cythonize@2213 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: ab7e0adb6f36b2ccfd52a8c652c1ea35258a7aa1 --- src/cython/include/Alpha_complex_interface.h | 4 ++++ .../Euclidean_strong_witness_complex_interface.h | 22 +++++++++++++--------- .../include/Euclidean_witness_complex_interface.h | 22 +++++++++++++--------- .../include/Strong_witness_complex_interface.h | 4 ++++ src/cython/include/Tangential_complex_interface.h | 4 ++++ src/cython/include/Witness_complex_interface.h | 4 ++++ 6 files changed, 42 insertions(+), 18 deletions(-) (limited to 'src/cython/include/Strong_witness_complex_interface.h') diff --git a/src/cython/include/Alpha_complex_interface.h b/src/cython/include/Alpha_complex_interface.h index f11a464b..d74ff304 100644 --- a/src/cython/include/Alpha_complex_interface.h +++ b/src/cython/include/Alpha_complex_interface.h @@ -50,6 +50,10 @@ class Alpha_complex_interface { alpha_complex_ = new Alpha_complex(off_file_name); } + ~Alpha_complex_interface() { + delete alpha_complex_; + } + std::vector get_point(int vh) { std::vector vd; try { diff --git a/src/cython/include/Euclidean_strong_witness_complex_interface.h b/src/cython/include/Euclidean_strong_witness_complex_interface.h index fc88a82d..67d85e18 100644 --- a/src/cython/include/Euclidean_strong_witness_complex_interface.h +++ b/src/cython/include/Euclidean_strong_witness_complex_interface.h @@ -48,27 +48,32 @@ class Euclidean_strong_witness_complex_interface { public: Euclidean_strong_witness_complex_interface(const std::vector>& landmarks, - const std::vector>& witnesses) - : landmarks_(landmarks.begin(), landmarks.end()), - witnesses_(witnesses.begin(), witnesses.end()), - witness_complex_(landmarks_, witnesses_) { + const std::vector>& witnesses) { + landmarks_.reserve(landmarks.size()); + for(auto& landmark : landmarks) + landmarks_.emplace_back(landmark.begin(), landmark.end()); + witness_complex_ = new Euclidean_strong_witness_complex(landmarks_, witnesses); + } + + ~Euclidean_strong_witness_complex_interface() { + delete witness_complex_; } void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { - witness_complex_.create_complex(*simplex_tree, max_alpha_square, limit_dimension); + witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); simplex_tree->initialize_filtration(); } void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square) { - witness_complex_.create_complex(*simplex_tree, max_alpha_square); + witness_complex_->create_complex(*simplex_tree, max_alpha_square); simplex_tree->initialize_filtration(); } std::vector get_point(unsigned vh) { std::vector vd; if (vh < landmarks_.size()) { - Point_d ph = witness_complex_.get_point(vh); + Point_d ph = witness_complex_->get_point(vh); for (auto coord = ph.cartesian_begin(); coord < ph.cartesian_end(); coord++) vd.push_back(*coord); } @@ -77,8 +82,7 @@ class Euclidean_strong_witness_complex_interface { private: std::vector landmarks_; - std::vector witnesses_; - Euclidean_strong_witness_complex witness_complex_; + Euclidean_strong_witness_complex* witness_complex_; }; } // namespace witness_complex diff --git a/src/cython/include/Euclidean_witness_complex_interface.h b/src/cython/include/Euclidean_witness_complex_interface.h index a1ec68aa..a2db6a2d 100644 --- a/src/cython/include/Euclidean_witness_complex_interface.h +++ b/src/cython/include/Euclidean_witness_complex_interface.h @@ -48,26 +48,31 @@ class Euclidean_witness_complex_interface { public: Euclidean_witness_complex_interface(const std::vector>& landmarks, - const std::vector>& witnesses) - : landmarks_(landmarks.begin(), landmarks.end()), - witnesses_(witnesses.begin(), witnesses.end()), - witness_complex_(landmarks_, witnesses_) { + const std::vector>& witnesses) { + landmarks_.reserve(landmarks.size()); + for(auto& landmark : landmarks) + landmarks_.emplace_back(landmark.begin(), landmark.end()); + witness_complex_ = new Euclidean_witness_complex(landmarks_, witnesses); + } + + ~Euclidean_witness_complex_interface() { + delete witness_complex_; } void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { - witness_complex_.create_complex(*simplex_tree, max_alpha_square, limit_dimension); + witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); simplex_tree->initialize_filtration(); } void create_simplex_tree(Gudhi::Simplex_tree<>* simplex_tree, double max_alpha_square) { - witness_complex_.create_complex(*simplex_tree, max_alpha_square); + witness_complex_->create_complex(*simplex_tree, max_alpha_square); simplex_tree->initialize_filtration(); } std::vector get_point(unsigned vh) { std::vector vd; if (vh < landmarks_.size()) { - Point_d ph = witness_complex_.get_point(vh); + Point_d ph = witness_complex_->get_point(vh); for (auto coord = ph.cartesian_begin(); coord < ph.cartesian_end(); coord++) vd.push_back(*coord); } @@ -76,8 +81,7 @@ class Euclidean_witness_complex_interface { private: std::vector landmarks_; - std::vector witnesses_; - Euclidean_witness_complex witness_complex_; + Euclidean_witness_complex* witness_complex_; }; } // namespace witness_complex diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h index 70e78a2a..83bf0f3c 100644 --- a/src/cython/include/Strong_witness_complex_interface.h +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -46,6 +46,10 @@ class Strong_witness_complex_interface { witness_complex_ = new Strong_witness_complex(nlt); } + ~Strong_witness_complex_interface() { + delete witness_complex_; + } + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); diff --git a/src/cython/include/Tangential_complex_interface.h b/src/cython/include/Tangential_complex_interface.h index 93d9bad7..2ca4c393 100644 --- a/src/cython/include/Tangential_complex_interface.h +++ b/src/cython/include/Tangential_complex_interface.h @@ -68,6 +68,10 @@ class Tangential_complex_interface { num_inconsistencies_ = tangential_complex_->number_of_inconsistent_simplices(); } + ~Tangential_complex_interface() { + delete tangential_complex_; + } + std::vector get_point(unsigned vh) { std::vector vd; if (vh < tangential_complex_->number_of_vertices()) { diff --git a/src/cython/include/Witness_complex_interface.h b/src/cython/include/Witness_complex_interface.h index 835b69ab..4f2a903b 100644 --- a/src/cython/include/Witness_complex_interface.h +++ b/src/cython/include/Witness_complex_interface.h @@ -46,6 +46,10 @@ class Witness_complex_interface { witness_complex_ = new Witness_complex(nlt); } + ~Witness_complex_interface() { + delete witness_complex_; + } + void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, double max_alpha_square, std::size_t limit_dimension) { witness_complex_->create_complex(*simplex_tree, max_alpha_square, limit_dimension); -- cgit v1.2.3 From f48eae4cd7dc50dbbe0c8ec4f63bb98dda51a5d8 Mon Sep 17 00:00:00 2001 From: vrouvrea Date: Fri, 24 Mar 2017 06:20:50 +0000 Subject: Fix cpplint on cython interfaces git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/trunk@2229 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: 41a958b1be51ac938b45b384cde7940a85e9dea0 --- .../doc/Intro_bottleneck_distance.h | 6 ++-- src/cython/include/Alpha_complex_interface.h | 6 ++-- src/cython/include/Bottleneck_distance_interface.h | 8 +++--- src/cython/include/Cubical_complex_interface.h | 8 ++---- .../Euclidean_strong_witness_complex_interface.h | 10 +++---- .../include/Euclidean_witness_complex_interface.h | 10 +++---- src/cython/include/Off_reader_interface.h | 6 ++-- .../include/Persistent_cohomology_interface.h | 32 +++++++++++----------- src/cython/include/Rips_complex_interface.h | 12 ++++---- src/cython/include/Simplex_tree_interface.h | 12 +++----- .../include/Strong_witness_complex_interface.h | 10 +++---- src/cython/include/Subsampling_interface.h | 8 ++---- src/cython/include/Tangential_complex_interface.h | 12 ++++---- src/cython/include/Witness_complex_interface.h | 9 +++--- 14 files changed, 68 insertions(+), 81 deletions(-) (limited to 'src/cython/include/Strong_witness_complex_interface.h') diff --git a/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h b/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h index 5223678d..3998fe8d 100644 --- a/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h +++ b/src/Bottleneck_distance/doc/Intro_bottleneck_distance.h @@ -35,9 +35,9 @@ namespace persistence_diagram { * * \section bottleneckdefinition Definition * - * The bottleneck distance measures the similarity between two persistence diagrams. It is the shortest distance b for which there exists a perfect matching between - * the points of the two diagrams (completed with all the points on the diagonal in order to ignore cardinality mismatchs) such that - * any couple of matched points are at distance at most b. + * The bottleneck distance measures the similarity between two persistence diagrams. It is the shortest distance b for + * which there exists a perfect matching between the points of the two diagrams (completed with all the points on the + * diagonal in order to ignore cardinality mismatchs) such that any couple of matched points are at distance at most b. * * \image html perturb_pd.png On this picture, the red edges represent the matching. The bottleneck distance is the length of the longest edge. * diff --git a/src/cython/include/Alpha_complex_interface.h b/src/cython/include/Alpha_complex_interface.h index d74ff304..d47db71f 100644 --- a/src/cython/include/Alpha_complex_interface.h +++ b/src/cython/include/Alpha_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef ALPHA_COMPLEX_INTERFACE_H -#define ALPHA_COMPLEX_INTERFACE_H +#ifndef INCLUDE_ALPHA_COMPLEX_INTERFACE_H_ +#define INCLUDE_ALPHA_COMPLEX_INTERFACE_H_ #include #include @@ -79,4 +79,4 @@ class Alpha_complex_interface { } // namespace Gudhi -#endif // ALPHA_COMPLEX_INTERFACE_H +#endif // INCLUDE_ALPHA_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Bottleneck_distance_interface.h b/src/cython/include/Bottleneck_distance_interface.h index 6819734b..d5fbf6ea 100644 --- a/src/cython/include/Bottleneck_distance_interface.h +++ b/src/cython/include/Bottleneck_distance_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef BOTTLENECK_DISTANCE_INTERFACE_H -#define BOTTLENECK_DISTANCE_INTERFACE_H +#ifndef INCLUDE_BOTTLENECK_DISTANCE_INTERFACE_H_ +#define INCLUDE_BOTTLENECK_DISTANCE_INTERFACE_H_ #include @@ -45,9 +45,9 @@ namespace persistence_diagram { return bottleneck_distance(diag1, diag2); } -} // namespace alpha_complex +} // namespace persistence_diagram } // namespace Gudhi -#endif // BOTTLENECK_DISTANCE_INTERFACE_H +#endif // INCLUDE_BOTTLENECK_DISTANCE_INTERFACE_H_ diff --git a/src/cython/include/Cubical_complex_interface.h b/src/cython/include/Cubical_complex_interface.h index 4c53523b..7c0148f1 100644 --- a/src/cython/include/Cubical_complex_interface.h +++ b/src/cython/include/Cubical_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef CUBICAL_COMPLEX_INTERFACE_H -#define CUBICAL_COMPLEX_INTERFACE_H +#ifndef INCLUDE_CUBICAL_COMPLEX_INTERFACE_H_ +#define INCLUDE_CUBICAL_COMPLEX_INTERFACE_H_ #include #include @@ -38,7 +38,6 @@ namespace cubical_complex { template> class Cubical_complex_interface : public Bitmap_cubical_complex { public: - Cubical_complex_interface(const std::vector& dimensions, const std::vector& top_dimensional_cells) : Bitmap_cubical_complex(dimensions, top_dimensional_cells) { @@ -47,12 +46,11 @@ class Cubical_complex_interface : public Bitmap_cubical_complex(perseus_file.c_str()) { } - }; } // namespace cubical_complex } // namespace Gudhi -#endif // CUBICAL_COMPLEX_INTERFACE_H +#endif // INCLUDE_CUBICAL_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Euclidean_strong_witness_complex_interface.h b/src/cython/include/Euclidean_strong_witness_complex_interface.h index 67d85e18..b9dd8177 100644 --- a/src/cython/include/Euclidean_strong_witness_complex_interface.h +++ b/src/cython/include/Euclidean_strong_witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H -#define EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_ #include #include @@ -50,7 +50,7 @@ class Euclidean_strong_witness_complex_interface { Euclidean_strong_witness_complex_interface(const std::vector>& landmarks, const std::vector>& witnesses) { landmarks_.reserve(landmarks.size()); - for(auto& landmark : landmarks) + for (auto& landmark : landmarks) landmarks_.emplace_back(landmark.begin(), landmark.end()); witness_complex_ = new Euclidean_strong_witness_complex(landmarks_, witnesses); } @@ -87,7 +87,7 @@ class Euclidean_strong_witness_complex_interface { } // namespace witness_complex -} // namespace Gudhi +} // namespace Gudhi -#endif // EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H +#endif // INCLUDE_EUCLIDEAN_STRONG_WITNESS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Euclidean_witness_complex_interface.h b/src/cython/include/Euclidean_witness_complex_interface.h index a2db6a2d..2a09b3b5 100644 --- a/src/cython/include/Euclidean_witness_complex_interface.h +++ b/src/cython/include/Euclidean_witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H -#define EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H_ #include #include @@ -50,7 +50,7 @@ class Euclidean_witness_complex_interface { Euclidean_witness_complex_interface(const std::vector>& landmarks, const std::vector>& witnesses) { landmarks_.reserve(landmarks.size()); - for(auto& landmark : landmarks) + for (auto& landmark : landmarks) landmarks_.emplace_back(landmark.begin(), landmark.end()); witness_complex_ = new Euclidean_witness_complex(landmarks_, witnesses); } @@ -86,7 +86,7 @@ class Euclidean_witness_complex_interface { } // namespace witness_complex -} // namespace Gudhi +} // namespace Gudhi -#endif // EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H +#endif // INCLUDE_EUCLIDEAN_WITNESS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Off_reader_interface.h b/src/cython/include/Off_reader_interface.h index 97d64d3e..0ca55500 100644 --- a/src/cython/include/Off_reader_interface.h +++ b/src/cython/include/Off_reader_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef OFF_READER_INTERFACE_H -#define OFF_READER_INTERFACE_H +#ifndef INCLUDE_OFF_READER_INTERFACE_H_ +#define INCLUDE_OFF_READER_INTERFACE_H_ #include @@ -38,5 +38,5 @@ std::vector> read_points_from_OFF_file(const std::string& of } // namespace Gudhi -#endif // OFF_READER_INTERFACE_H +#endif // INCLUDE_OFF_READER_INTERFACE_H_ diff --git a/src/cython/include/Persistent_cohomology_interface.h b/src/cython/include/Persistent_cohomology_interface.h index 1ff0e09b..25c458d2 100644 --- a/src/cython/include/Persistent_cohomology_interface.h +++ b/src/cython/include/Persistent_cohomology_interface.h @@ -20,13 +20,14 @@ * along with this program. If not, see . */ -#ifndef PERSISTENT_COHOMOLOGY_INTERFACE_H -#define PERSISTENT_COHOMOLOGY_INTERFACE_H +#ifndef INCLUDE_PERSISTENT_COHOMOLOGY_INTERFACE_H_ +#define INCLUDE_PERSISTENT_COHOMOLOGY_INTERFACE_H_ #include #include #include // for std::pair +#include // for sort namespace Gudhi { @@ -34,12 +35,10 @@ template class Persistent_cohomology_interface : public persistent_cohomology::Persistent_cohomology { private: - /* * Compare two intervals by dimension, then by length. */ struct cmp_intervals_by_dim_then_length { - explicit cmp_intervals_by_dim_then_length(FilteredComplex * sc) : sc_(sc) { } @@ -55,23 +54,26 @@ persistent_cohomology::Persistent_cohomology(*stptr), stptr_(stptr) { } Persistent_cohomology_interface(FilteredComplex* stptr, bool persistence_dim_max) - : persistent_cohomology::Persistent_cohomology(*stptr, - persistence_dim_max), - stptr_(stptr) { } + : persistent_cohomology::Persistent_cohomology(*stptr, persistence_dim_max), + stptr_(stptr) { } - std::vector>> get_persistence(int homology_coeff_field, double min_persistence) { - persistent_cohomology::Persistent_cohomology::init_coefficients(homology_coeff_field); - persistent_cohomology::Persistent_cohomology::compute_persistent_cohomology(min_persistence); + std::vector>> get_persistence(int homology_coeff_field, + double min_persistence) { + persistent_cohomology::Persistent_cohomology::init_coefficients(homology_coeff_field); + persistent_cohomology::Persistent_cohomology::compute_persistent_cohomology(min_persistence); // Custom sort and output persistence cmp_intervals_by_dim_then_length cmp(stptr_); - auto persistent_pairs = persistent_cohomology::Persistent_cohomology::get_persistent_pairs(); + auto persistent_pairs = persistent_cohomology::Persistent_cohomology::get_persistent_pairs(); std::sort(std::begin(persistent_pairs), std::end(persistent_pairs), cmp); std::vector>> persistence; @@ -81,7 +83,6 @@ persistent_cohomology::Persistent_cohomologyfiltration(get<1>(pair))))); } return persistence; - } private: @@ -90,7 +91,6 @@ persistent_cohomology::Persistent_cohomology. */ -#ifndef RIPS_COMPLEX_INTERFACE_H -#define RIPS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_RIPS_COMPLEX_INTERFACE_H_ +#define INCLUDE_RIPS_COMPLEX_INTERFACE_H_ #include #include @@ -53,7 +53,6 @@ class Rips_complex_interface { } else { // Rips construction where values is a distance matrix rips_complex_ = new Rips_complex::Filtration_value>(values, threshold); - } } @@ -65,11 +64,10 @@ class Rips_complex_interface { threshold, Euclidean_distance()); } else { // Rips construction where values is a distance matrix - Distance_matrix distances = read_lower_triangular_matrix_from_csv_file::Filtration_value>(file_name); + Distance_matrix distances = + read_lower_triangular_matrix_from_csv_file::Filtration_value>(file_name); rips_complex_ = new Rips_complex::Filtration_value>(distances, threshold); - } - } void create_simplex_tree(Simplex_tree_interface<>* simplex_tree, int dim_max) { @@ -85,4 +83,4 @@ class Rips_complex_interface { } // namespace Gudhi -#endif // RIPS_COMPLEX_INTERFACE_H +#endif // INCLUDE_RIPS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Simplex_tree_interface.h b/src/cython/include/Simplex_tree_interface.h index c2783e22..4266b3ef 100644 --- a/src/cython/include/Simplex_tree_interface.h +++ b/src/cython/include/Simplex_tree_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef SIMPLEX_TREE_INTERFACE_H -#define SIMPLEX_TREE_INTERFACE_H +#ifndef INCLUDE_SIMPLEX_TREE_INTERFACE_H_ +#define INCLUDE_SIMPLEX_TREE_INTERFACE_H_ #include #include @@ -48,7 +48,6 @@ class Simplex_tree_interface : public Simplex_tree { using Complex = std::vector>; public: - bool find_simplex(const Simplex& vh) { return (Base::find(vh) != Base::null_simplex()); } @@ -98,7 +97,6 @@ class Simplex_tree_interface : public Simplex_tree { filtered_tree.push_back(std::make_pair(simplex, Base::filtration(f_simplex))); } return filtered_tree; - } Complex get_skeleton_tree(int dimension) { @@ -144,10 +142,8 @@ class Simplex_tree_interface : public Simplex_tree { void create_persistence(Gudhi::Persistent_cohomology_interface* pcoh) { pcoh = new Gudhi::Persistent_cohomology_interface(*this); } - }; -} // namespace Gudhi - -#endif // SIMPLEX_TREE_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_SIMPLEX_TREE_INTERFACE_H_ diff --git a/src/cython/include/Strong_witness_complex_interface.h b/src/cython/include/Strong_witness_complex_interface.h index 83bf0f3c..d05eaac5 100644 --- a/src/cython/include/Strong_witness_complex_interface.h +++ b/src/cython/include/Strong_witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef STRONG_WITNESS_COMPLEX_INTERFACE_H -#define STRONG_WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_STRONG_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_STRONG_WITNESS_COMPLEX_INTERFACE_H_ #include #include @@ -64,12 +64,10 @@ class Strong_witness_complex_interface { private: Strong_witness_complex* witness_complex_; - }; } // namespace witness_complex -} // namespace Gudhi - -#endif // STRONG_WITNESS_COMPLEX_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_STRONG_WITNESS_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Subsampling_interface.h b/src/cython/include/Subsampling_interface.h index 5fc16767..1c6032c0 100644 --- a/src/cython/include/Subsampling_interface.h +++ b/src/cython/include/Subsampling_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef SUBSAMPLING_INTERFACE_H -#define SUBSAMPLING_INTERFACE_H +#ifndef INCLUDE_SUBSAMPLING_INTERFACE_H_ +#define INCLUDE_SUBSAMPLING_INTERFACE_H_ #include #include @@ -112,10 +112,8 @@ std::vector> subsampling_sparsify_points_from_file(const std return subsampling_sparsify_points(points, min_squared_dist); } - } // namespace subsampling } // namespace Gudhi -#endif // SUBSAMPLING_INTERFACE_H - +#endif // INCLUDE_SUBSAMPLING_INTERFACE_H_ diff --git a/src/cython/include/Tangential_complex_interface.h b/src/cython/include/Tangential_complex_interface.h index 2ca4c393..5e9dc0e4 100644 --- a/src/cython/include/Tangential_complex_interface.h +++ b/src/cython/include/Tangential_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef TANGENTIAL_COMPLEX_INTERFACE_H -#define TANGENTIAL_COMPLEX_INTERFACE_H +#ifndef INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ +#define INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ #include #include @@ -33,6 +33,7 @@ #include #include // std::pair #include +#include namespace Gudhi { @@ -49,7 +50,7 @@ class Tangential_complex_interface { 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(); @@ -117,7 +118,6 @@ class Tangential_complex_interface { } // namespace tangential_complex -} // namespace Gudhi - -#endif // TANGENTIAL_COMPLEX_INTERFACE_H +} // namespace Gudhi +#endif // INCLUDE_TANGENTIAL_COMPLEX_INTERFACE_H_ diff --git a/src/cython/include/Witness_complex_interface.h b/src/cython/include/Witness_complex_interface.h index 4f2a903b..6501cc35 100644 --- a/src/cython/include/Witness_complex_interface.h +++ b/src/cython/include/Witness_complex_interface.h @@ -20,8 +20,8 @@ * along with this program. If not, see . */ -#ifndef WITNESS_COMPLEX_INTERFACE_H -#define WITNESS_COMPLEX_INTERFACE_H +#ifndef INCLUDE_WITNESS_COMPLEX_INTERFACE_H_ +#define INCLUDE_WITNESS_COMPLEX_INTERFACE_H_ #include #include @@ -64,12 +64,11 @@ class Witness_complex_interface { private: Witness_complex* witness_complex_; - }; } // namespace witness_complex -} // namespace Gudhi +} // namespace Gudhi -#endif // WITNESS_COMPLEX_INTERFACE_H +#endif // INCLUDE_WITNESS_COMPLEX_INTERFACE_H_ -- cgit v1.2.3