diff options
author | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-04-27 06:27:28 +0000 |
---|---|---|
committer | vrouvrea <vrouvrea@636b058d-ea47-450e-bf9e-a15bfbe3eedb> | 2018-04-27 06:27:28 +0000 |
commit | 41029d1e7692cf41e0e4e0eec7cc33b2949e2cf0 (patch) | |
tree | f8fee531118fa47ddfa3d8e90d5ad966a78d7343 /src/Rips_complex/example/example_sparse_rips.cpp | |
parent | be6997e1cb3b7e6feeb3ece37437f02e6c60a18b (diff) | |
parent | 979de853d97225b2b5466ec0a896a06dd08325e9 (diff) |
Merge Copyright clarification
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/cechcomplex_vincent@3402 636b058d-ea47-450e-bf9e-a15bfbe3eedb
Former-commit-id: c24c2226a76df7a6a95d2531e98850c7c19580e1
Diffstat (limited to 'src/Rips_complex/example/example_sparse_rips.cpp')
-rw-r--r-- | src/Rips_complex/example/example_sparse_rips.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/Rips_complex/example/example_sparse_rips.cpp b/src/Rips_complex/example/example_sparse_rips.cpp new file mode 100644 index 00000000..1c95b48c --- /dev/null +++ b/src/Rips_complex/example/example_sparse_rips.cpp @@ -0,0 +1,30 @@ +#include <gudhi/Sparse_rips_complex.h> +#include <gudhi/Simplex_tree.h> +#include <gudhi/distance_functions.h> + +#include <iostream> +#include <vector> + +int main() { + using Point = std::vector<double>; + using Simplex_tree = Gudhi::Simplex_tree<Gudhi::Simplex_tree_options_fast_persistence>; + using Filtration_value = Simplex_tree::Filtration_value; + using Sparse_rips = Gudhi::rips_complex::Sparse_rips_complex<Filtration_value>; + + Point points[] = {{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}}; + + // ---------------------------------------------------------------------------- + // Init from Euclidean points + // ---------------------------------------------------------------------------- + double epsilon = 2; // very rough, no guarantees + Sparse_rips sparse_rips(points, Gudhi::Euclidean_distance(), epsilon); + + Simplex_tree stree; + sparse_rips.create_complex(stree, 10); + + // ---------------------------------------------------------------------------- + // Display information about the complex + // ---------------------------------------------------------------------------- + std::cout << "Sparse Rips complex is of dimension " << stree.dimension() << " - " << stree.num_simplices() + << " simplices - " << stree.num_vertices() << " vertices." << std::endl; +} |