diff options
author | skachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-10-07 09:49:47 +0000 |
---|---|---|
committer | skachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2016-10-07 09:49:47 +0000 |
commit | 1bcd448f6e217655fae4bfbf62d8d3b6caa52503 (patch) | |
tree | 11fb20c5050269b26252e5a673720239b6edc8d8 /src/Witness_complex/example | |
parent | 07e6b3d053144329a03bf7c8f52538d221e6ea6d (diff) |
Added the possibility to limit dimension
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1676 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: 16ec8706ffb981ff892960468cc4b809e61612e2
Diffstat (limited to 'src/Witness_complex/example')
3 files changed, 18 insertions, 10 deletions
diff --git a/src/Witness_complex/example/example_strong_witness_persistence.cpp b/src/Witness_complex/example/example_strong_witness_persistence.cpp index bf6b4011..4e06867d 100644 --- a/src/Witness_complex/example/example_strong_witness_persistence.cpp +++ b/src/Witness_complex/example/example_strong_witness_persistence.cpp @@ -53,17 +53,18 @@ void program_options(int argc, char * argv[] , std::string & filediag , Filtration_value & max_squared_alpha , int & p + , int & dim_max , Filtration_value & min_persistence); int main(int argc, char * argv[]) { std::string file_name; std::string filediag; Filtration_value max_squared_alpha; - int p, nbL; + int p, nbL, lim_d; Filtration_value min_persistence; SimplexTree simplex_tree; - program_options(argc, argv, nbL, file_name, filediag, max_squared_alpha, p, min_persistence); + program_options(argc, argv, nbL, file_name, filediag, max_squared_alpha, p, lim_d, min_persistence); // Extract the points from the file file_name Point_vector witnesses, landmarks; @@ -119,6 +120,7 @@ void program_options(int argc, char * argv[] , std::string & filediag , Filtration_value & max_squared_alpha , int & p + , int & dim_max , Filtration_value & min_persistence) { namespace po = boost::program_options; @@ -141,7 +143,9 @@ void program_options(int argc, char * argv[] ("field-charac,p", po::value<int>(&p)->default_value(11), "Characteristic p of the coefficient field Z/pZ for computing homology.") ("min-persistence,m", po::value<Filtration_value>(&min_persistence)->default_value(0), - "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals"); + "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals") + ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(std::numeric_limits<int>::max()), + "Maximal dimension of the strong witness complex we want to compute."); po::positional_options_description pos; pos.add("input-file", 1); diff --git a/src/Witness_complex/example/example_witness_complex_off.cpp b/src/Witness_complex/example/example_witness_complex_off.cpp index 849a0a40..37646faf 100644 --- a/src/Witness_complex/example/example_witness_complex_off.cpp +++ b/src/Witness_complex/example/example_witness_complex_off.cpp @@ -45,12 +45,12 @@ typedef std::vector< Point_d > Point_vector; int main(int argc, char * const argv[]) { if (argc != 4) { std::cerr << "Usage: " << argv[0] - << " path_to_point_file nbL alpha^2\n"; + << " path_to_point_file number_of_landmarks max_squared_alpha limit_dimension\n"; return 0; } std::string file_name = argv[1]; - int nbL = atoi(argv[2]); + int nbL = atoi(argv[2]), lim_dim = atoi(argv[4]); double alpha2 = atof(argv[3]); clock_t start, end; Gudhi::Simplex_tree<> simplex_tree; @@ -77,7 +77,7 @@ int main(int argc, char * const argv[]) { point_vector.begin(), point_vector.end()); - witness_complex.create_complex(simplex_tree, alpha2); + witness_complex.create_complex(simplex_tree, alpha2, lim_dim); end = clock(); std::cout << "Witness complex took " << static_cast<double>(end - start) / CLOCKS_PER_SEC << " s. \n"; diff --git a/src/Witness_complex/example/example_witness_complex_persistence.cpp b/src/Witness_complex/example/example_witness_complex_persistence.cpp index 9b06b504..a4388047 100644 --- a/src/Witness_complex/example/example_witness_complex_persistence.cpp +++ b/src/Witness_complex/example/example_witness_complex_persistence.cpp @@ -53,17 +53,18 @@ void program_options(int argc, char * argv[] , std::string & filediag , Filtration_value & max_squared_alpha , int & p + , int & dim_max , Filtration_value & min_persistence); int main(int argc, char * argv[]) { std::string file_name; std::string filediag; Filtration_value max_squared_alpha; - int p, nbL; + int p, nbL, lim_d; Filtration_value min_persistence; SimplexTree simplex_tree; - program_options(argc, argv, nbL, file_name, filediag, max_squared_alpha, p, min_persistence); + program_options(argc, argv, nbL, file_name, filediag, max_squared_alpha, p, lim_d, min_persistence); // Extract the points from the file file_name Point_vector witnesses, landmarks; @@ -119,6 +120,7 @@ void program_options(int argc, char * argv[] , std::string & filediag , Filtration_value & max_squared_alpha , int & p + , int & dim_max , Filtration_value & min_persistence) { namespace po = boost::program_options; @@ -141,8 +143,10 @@ void program_options(int argc, char * argv[] ("field-charac,p", po::value<int>(&p)->default_value(11), "Characteristic p of the coefficient field Z/pZ for computing homology.") ("min-persistence,m", po::value<Filtration_value>(&min_persistence)->default_value(0), - "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals"); - + "Minimal lifetime of homology feature to be recorded. Default is 0. Enter a negative value to see zero length intervals") + ("cpx-dimension,d", po::value<int>(&dim_max)->default_value(std::numeric_limits<int>::max()), + "Maximal dimension of the weak witness complex we want to compute."); + po::positional_options_description pos; pos.add("input-file", 1); |