summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-20 13:44:20 +0000
committervrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-03-20 13:44:20 +0000
commit10411aae9845d28d36a9d4394bd668ed84d540f1 (patch)
tree0d62f001377fa6b7c8a75adac0818ad1790d8302 /src
parent948341a6bf6e9ee8b5e61ae0e2b9ce6452751b76 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/cython/include/Alpha_complex_interface.h4
-rw-r--r--src/cython/include/Bottleneck_distance_interface.h8
-rw-r--r--src/cython/include/Euclidean_strong_witness_complex_interface.h6
-rw-r--r--src/cython/include/Euclidean_witness_complex_interface.h3
-rw-r--r--src/cython/include/Off_reader_interface.h2
-rw-r--r--src/cython/include/Rips_complex_interface.h4
-rw-r--r--src/cython/include/Strong_witness_complex_interface.h2
-rw-r--r--src/cython/include/Subsampling_interface.h24
-rw-r--r--src/cython/include/Tangential_complex_interface.h4
-rw-r--r--src/cython/include/Witness_complex_interface.h2
10 files changed, 35 insertions, 24 deletions
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<std::vector<double>>&points) {
+ Alpha_complex_interface(const std::vector<std::vector<double>>& points) {
alpha_complex_ = new Alpha_complex<Dynamic_kernel>(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<Dynamic_kernel>(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<std::pair<double, double>> &diag1,
- const std::vector<std::pair<double, double>> &diag2,
+ double bottleneck(const std::vector<std::pair<double, double>>& diag1,
+ const std::vector<std::pair<double, double>>& diag2,
double e) {
return bottleneck_distance(diag1, diag2, e);
}
- double bottleneck(const std::vector<std::pair<double, double>> &diag1,
- const std::vector<std::pair<double, double>> &diag2) {
+ double bottleneck(const std::vector<std::pair<double, double>>& diag1,
+ const std::vector<std::pair<double, double>>& 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<std::vector<double>>&landmarks, std::vector<std::vector<double>>&witnesses)
+ Euclidean_strong_witness_complex_interface(const std::vector<std::vector<double>>& landmarks,
+ const std::vector<std::vector<double>>& 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<std::vector<double>>&landmarks, std::vector<std::vector<double>>&witnesses)
+ Euclidean_witness_complex_interface(const std::vector<std::vector<double>>& landmarks,
+ const std::vector<std::vector<double>>& 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<std::vector<double>> read_points_from_OFF_file(std::string& off_file) {
+std::vector<std::vector<double>> read_points_from_OFF_file(const std::string& off_file) {
Gudhi::Points_off_reader<std::vector<double>> 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<std::vector<Simplex_tree_interface<>::Filtration_value>>;
public:
- Rips_complex_interface(std::vector<std::vector<double>>&values, double threshold, bool euclidean) {
+ Rips_complex_interface(const std::vector<std::vector<double>>& values, double threshold, bool euclidean) {
if (euclidean) {
// Rips construction where values is a vector of points
rips_complex_ = new Rips_complex<Simplex_tree_interface<>::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<Point_d> 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<Nearest_landmark_range>;
public:
- Strong_witness_complex_interface(Nearest_landmark_table& nlt) {
+ Strong_witness_complex_interface(const Nearest_landmark_table& nlt) {
witness_complex_ = new Strong_witness_complex<Nearest_landmark_table>(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<std::vector<double>> subsampling_n_farthest_points(std::vector<std::vector<double>>& points, unsigned nb_points) {
+std::vector<std::vector<double>> subsampling_n_farthest_points(const std::vector<std::vector<double>>& points,
+ unsigned nb_points) {
std::vector<std::vector<double>> landmarks;
Subsampling_dynamic_kernel k;
choose_n_farthest_points(k, points, nb_points, std::back_inserter(landmarks));
@@ -50,7 +51,8 @@ std::vector<std::vector<double>> subsampling_n_farthest_points(std::vector<std::
return landmarks;
}
-std::vector<std::vector<double>> subsampling_n_farthest_points(std::vector<std::vector<double>>& points, unsigned nb_points, unsigned starting_point) {
+std::vector<std::vector<double>> subsampling_n_farthest_points(const std::vector<std::vector<double>>& points,
+ unsigned nb_points, unsigned starting_point) {
std::vector<std::vector<double>> 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<std::vector<double>> subsampling_n_farthest_points(std::vector<std::
return landmarks;
}
-std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(std::string& off_file, unsigned nb_points) {
+std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(const std::string& off_file,
+ unsigned nb_points) {
Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file);
std::vector<std::vector<double>> points = off_reader.get_point_cloud();
return subsampling_n_farthest_points(points, nb_points);
}
-std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(std::string& off_file, unsigned nb_points, unsigned starting_point) {
+std::vector<std::vector<double>> subsampling_n_farthest_points_from_file(const std::string& off_file,
+ unsigned nb_points, unsigned starting_point) {
Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file);
std::vector<std::vector<double>> points = off_reader.get_point_cloud();
return subsampling_n_farthest_points(points, nb_points, starting_point);
}
// ------ pick_n_random_points ------
-std::vector<std::vector<double>> subsampling_n_random_points(std::vector<std::vector<double>>& points, unsigned nb_points) {
+std::vector<std::vector<double>> subsampling_n_random_points(const std::vector<std::vector<double>>& points,
+ unsigned nb_points) {
std::vector<std::vector<double>> landmarks;
pick_n_random_points(points, nb_points, std::back_inserter(landmarks));
return landmarks;
}
-std::vector<std::vector<double>> subsampling_n_random_points_from_file(std::string& off_file, unsigned nb_points) {
+std::vector<std::vector<double>> subsampling_n_random_points_from_file(const std::string& off_file,
+ unsigned nb_points) {
Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file);
std::vector<std::vector<double>> points = off_reader.get_point_cloud();
return subsampling_n_random_points(points, nb_points);
}
// ------ sparsify_point_set ------
-std::vector<std::vector<double>> subsampling_sparsify_points(std::vector<std::vector<double>>& points, double min_squared_dist) {
+std::vector<std::vector<double>> subsampling_sparsify_points(const std::vector<std::vector<double>>& points,
+ double min_squared_dist) {
std::vector<Subsampling_point_d> input, output;
for (auto point : points)
input.push_back(Subsampling_point_d(point.size(), point.begin(), point.end()));
@@ -98,7 +105,8 @@ std::vector<std::vector<double>> subsampling_sparsify_points(std::vector<std::ve
return landmarks;
}
-std::vector<std::vector<double>> subsampling_sparsify_points_from_file(std::string& off_file, double min_squared_dist) {
+std::vector<std::vector<double>> subsampling_sparsify_points_from_file(const std::string& off_file,
+ double min_squared_dist) {
Gudhi::Points_off_reader<std::vector<double>> off_reader(off_file);
std::vector<std::vector<double>> 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<Dynamic_kernel, CGAL::Dynamic_dimension_tag, CGAL::Parallel_tag>;
public:
- Tangential_complex_interface(std::vector<std::vector<double>>&points) {
+ Tangential_complex_interface(const std::vector<std::vector<double>>& 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<Point_d> 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<Nearest_landmark_range>;
public:
- Witness_complex_interface(Nearest_landmark_table& nlt) {
+ Witness_complex_interface(const Nearest_landmark_table& nlt) {
witness_complex_ = new Witness_complex<Nearest_landmark_table>(nlt);
}