summaryrefslogtreecommitdiff
path: root/src/Rips_complex
diff options
context:
space:
mode:
Diffstat (limited to 'src/Rips_complex')
-rw-r--r--src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp8
-rw-r--r--src/Rips_complex/example/example_rips_complex_from_off_file.cpp8
-rw-r--r--src/Rips_complex/test/CMakeLists.txt5
-rw-r--r--src/Rips_complex/utilities/ripscomplex.md1
-rw-r--r--src/Rips_complex/utilities/sparse_rips_persistence.cpp15
5 files changed, 22 insertions, 15 deletions
diff --git a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
index 9e182f1e..b7040453 100644
--- a/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
+++ b/src/Rips_complex/example/example_rips_complex_from_csv_distance_matrix_file.cpp
@@ -35,19 +35,19 @@ int main(int argc, char **argv) {
Distance_matrix distances = Gudhi::read_lower_triangular_matrix_from_csv_file<Filtration_value>(csv_file_name);
Rips_complex rips_complex_from_file(distances, threshold);
- std::streambuf* streambufffer;
+ std::streambuf* streambuffer;
std::ofstream ouput_file_stream;
if (argc == 5) {
ouput_file_stream.open(std::string(argv[4]));
- streambufffer = ouput_file_stream.rdbuf();
+ streambuffer = ouput_file_stream.rdbuf();
} else {
- streambufffer = std::cout.rdbuf();
+ streambuffer = std::cout.rdbuf();
}
Simplex_tree stree;
rips_complex_from_file.create_complex(stree, dim_max);
- std::ostream output_stream(streambufffer);
+ std::ostream output_stream(streambuffer);
// ----------------------------------------------------------------------------
// Display information about the Rips complex
diff --git a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
index de2e4ea4..36b468a7 100644
--- a/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
+++ b/src/Rips_complex/example/example_rips_complex_from_off_file.cpp
@@ -34,19 +34,19 @@ int main(int argc, char **argv) {
Gudhi::Points_off_reader<Point> off_reader(off_file_name);
Rips_complex rips_complex_from_file(off_reader.get_point_cloud(), threshold, Gudhi::Euclidean_distance());
- std::streambuf* streambufffer;
+ std::streambuf* streambuffer;
std::ofstream ouput_file_stream;
if (argc == 5) {
ouput_file_stream.open(std::string(argv[4]));
- streambufffer = ouput_file_stream.rdbuf();
+ streambuffer = ouput_file_stream.rdbuf();
} else {
- streambufffer = std::cout.rdbuf();
+ streambuffer = std::cout.rdbuf();
}
Simplex_tree stree;
rips_complex_from_file.create_complex(stree, dim_max);
- std::ostream output_stream(streambufffer);
+ std::ostream output_stream(streambuffer);
// ----------------------------------------------------------------------------
// Display information about the Rips complex
diff --git a/src/Rips_complex/test/CMakeLists.txt b/src/Rips_complex/test/CMakeLists.txt
index 745d953c..b359584e 100644
--- a/src/Rips_complex/test/CMakeLists.txt
+++ b/src/Rips_complex/test/CMakeLists.txt
@@ -1,9 +1,8 @@
project(Rips_complex_tests)
-include(GUDHI_test_coverage)
+include(GUDHI_boost_test)
add_executable ( Rips_complex_test_unit test_rips_complex.cpp )
-target_link_libraries(Rips_complex_test_unit ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY})
if (TBB_FOUND)
target_link_libraries(Rips_complex_test_unit ${TBB_LIBRARIES})
endif()
@@ -12,4 +11,4 @@ endif()
file(COPY "${CMAKE_SOURCE_DIR}/data/points/alphacomplexdoc.off" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
file(COPY "${CMAKE_SOURCE_DIR}/data/distance_matrix/full_square_distance_matrix.csv" DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/)
-gudhi_add_coverage_test(Rips_complex_test_unit)
+gudhi_add_boost_test(Rips_complex_test_unit)
diff --git a/src/Rips_complex/utilities/ripscomplex.md b/src/Rips_complex/utilities/ripscomplex.md
index 03838085..61f31e3c 100644
--- a/src/Rips_complex/utilities/ripscomplex.md
+++ b/src/Rips_complex/utilities/ripscomplex.md
@@ -99,6 +99,7 @@ where `dim` is the dimension of the homological feature, `birth` and `death` are
* `-h [ --help ]` Produce help message
* `-o [ --output-file ]` Name of file in which the persistence diagram is written. Default print in standard output.
+* `-r [ --max-edge-length ]` (default = inf) Maximal length of an edge for the Rips complex construction.
* `-e [ --approximation ]` (default = .5) Epsilon, where the sparse Rips complex is a (1+epsilon)/(1-epsilon)-approximation of the Rips complex.
* `-d [ --cpx-dimension ]` (default = INT_MAX) Maximal dimension of the Rips complex we want to compute.
* `-p [ --field-charac ]` (default = 11) Characteristic p of the coefficient field Z/pZ for computing homology.
diff --git a/src/Rips_complex/utilities/sparse_rips_persistence.cpp b/src/Rips_complex/utilities/sparse_rips_persistence.cpp
index 1a86eafe..cefd8a67 100644
--- a/src/Rips_complex/utilities/sparse_rips_persistence.cpp
+++ b/src/Rips_complex/utilities/sparse_rips_persistence.cpp
@@ -28,21 +28,24 @@ using Persistent_cohomology = Gudhi::persistent_cohomology::Persistent_cohomolog
using Point = std::vector<double>;
using Points_off_reader = Gudhi::Points_off_reader<Point>;
-void program_options(int argc, char* argv[], std::string& off_file_points, std::string& filediag, double& epsilon,
+void program_options(int argc, char* argv[], std::string& off_file_points, std::string& filediag,
+ Filtration_value& threshold, double& epsilon,
int& dim_max, int& p, Filtration_value& min_persistence);
int main(int argc, char* argv[]) {
std::string off_file_points;
std::string filediag;
+ Filtration_value threshold;
double epsilon;
int dim_max;
int p;
Filtration_value min_persistence;
- program_options(argc, argv, off_file_points, filediag, epsilon, dim_max, p, min_persistence);
+ program_options(argc, argv, off_file_points, filediag, threshold, epsilon, dim_max, p, min_persistence);
Points_off_reader off_reader(off_file_points);
- Sparse_rips sparse_rips(off_reader.get_point_cloud(), Gudhi::Euclidean_distance(), epsilon);
+ Sparse_rips sparse_rips(off_reader.get_point_cloud(), Gudhi::Euclidean_distance(), epsilon,
+ -std::numeric_limits<Filtration_value>::infinity(), threshold);
// Construct the Rips complex in a Simplex Tree
Simplex_tree simplex_tree;
@@ -73,7 +76,8 @@ int main(int argc, char* argv[]) {
return 0;
}
-void program_options(int argc, char* argv[], std::string& off_file_points, std::string& filediag, double& epsilon,
+void program_options(int argc, char* argv[], std::string& off_file_points, std::string& filediag,
+ Filtration_value& threshold, double& epsilon,
int& dim_max, int& p, Filtration_value& min_persistence) {
namespace po = boost::program_options;
po::options_description hidden("Hidden options");
@@ -84,6 +88,9 @@ void program_options(int argc, char* argv[], std::string& off_file_points, std::
visible.add_options()("help,h", "produce help message")(
"output-file,o", po::value<std::string>(&filediag)->default_value(std::string()),
"Name of file in which the persistence diagram is written. Default print in std::cout")(
+ "max-edge-length,r",
+ po::value<Filtration_value>(&threshold)->default_value(std::numeric_limits<Filtration_value>::infinity()),
+ "Maximal length of an edge for the Rips complex construction.")(
"approximation,e", po::value<double>(&epsilon)->default_value(.5),
"Epsilon, where the sparse Rips complex is a (1+epsilon)-approximation of the Rips complex.")(
"cpx-dimension,d", po::value<int>(&dim_max)->default_value(std::numeric_limits<int>::max()),