Loading...
Searching...
No Matches
example_nearest_landmark_table.cpp
#define BOOST_PARAMETER_MAX_ARITY 12
#include <gudhi/Simplex_tree.h>
#include <gudhi/Witness_complex.h>
#include <gudhi/Persistent_cohomology.h>
#include <iostream>
#include <fstream>
#include <utility>
#include <string>
#include <vector>
int main(int argc, char * const argv[]) {
using Nearest_landmark_range = std::vector<std::pair<std::size_t, double>>;
using Nearest_landmark_table = std::vector<Nearest_landmark_range>;
Simplex_tree simplex_tree;
// Example contains 5 witnesses and 5 landmarks
Nearest_landmark_table nlt = {
{{0, 0.0}, {1, 0.1}, {2, 0.2}, {3, 0.3}, {4, 0.4}}, // witness 0
{{1, 0.0}, {2, 0.1}, {3, 0.2}, {4, 0.3}, {0, 0.4}}, // witness 1
{{2, 0.0}, {3, 0.1}, {4, 0.2}, {0, 0.3}, {1, 0.4}}, // witness 2
{{3, 0.0}, {4, 0.1}, {0, 0.2}, {1, 0.3}, {2, 0.4}}, // witness 3
{{4, 0.0}, {0, 0.1}, {1, 0.2}, {2, 0.3}, {3, 0.4}} // witness 4
};
/* distance(witness3, landmark3) is 0, distance(witness3, landmark4) is 0.1, etc. */
Witness_complex witness_complex(nlt);
witness_complex.create_complex(simplex_tree, .41);
std::clog << "Number of simplices: " << simplex_tree.num_simplices() << std::endl;
Persistent_cohomology pcoh(simplex_tree);
// initializes the coefficient field for homology
}
size_t num_simplices()
Returns the number of simplices in the simplex_tree.
Definition: Simplex_tree.h:664
Structure representing the coefficient field .
Definition: Field_Zp.h:27
Computes the persistent cohomology of a filtered complex.
Definition: Persistent_cohomology.h:54
void output_diagram(std::ostream &ostream=std::cout)
Output the persistence diagram in ostream.
Definition: Persistent_cohomology.h:559
void compute_persistent_cohomology(Filtration_value min_interval_length=0)
Compute the persistent homology of the filtered simplicial complex.
Definition: Persistent_cohomology.h:168
void init_coefficients(int charac)
Initializes the coefficient field.
Definition: Persistent_cohomology.h:152
Constructs strong witness complex for given sets of witnesses and landmarks in Euclidean space.
Definition: Euclidean_strong_witness_complex.h:51
bool create_complex(SimplicialComplexForWitness &complex, double max_alpha_square, Landmark_id limit_dimension=std::numeric_limits< Landmark_id >::max()) const
Outputs the strong witness complex of relaxation 'max_alpha_square' in a simplicial complex data stru...
Definition: Strong_witness_complex.h:87
Constructs (weak) witness complex for a given table of nearest landmarks with respect to witnesses.
Definition: Witness_complex.h:38