#include <gudhi/Simplex_tree.h>
#include <gudhi/Persistent_cohomology.h>
#include <iostream>
#include <ctime>
#include <utility>
#include <vector>
using typeVectorVertex = std::vector< Simplex_tree::Vertex_handle >;
void usage(char * const progName) {
std::cerr << "Usage: " << progName << " coeff_field_characteristic[integer > 0] min_persistence[float >= -1.0]\n";
exit(-1);
}
int main(int argc, char * const argv[]) {
if (argc != 3) {
std::cerr << "Error: Number of arguments (" << argc << ") is not correct\n";
usage(argv[0]);
}
int coeff_field_characteristic = 0;
int returnedScanValue = sscanf(argv[1], "%d", &coeff_field_characteristic);
if ((returnedScanValue == EOF) || (coeff_field_characteristic <= 0)) {
std::cerr << "Error: " << argv[1] << " is not correct\n";
usage(argv[0]);
}
returnedScanValue = sscanf(argv[2], "%lf", &min_persistence);
if ((returnedScanValue == EOF) || (min_persistence < -1.0)) {
std::cerr << "Error: " << argv[2] << " is not correct\n";
usage(argv[0]);
}
std::clog << "********************************************************************" << std::endl;
std::clog << "TEST OF INSERTION" << std::endl;
std::clog << " - INSERT (0,1,2)" << std::endl;
typeVectorVertex SimplexVector = {0, 1, 2};
std::clog << " - INSERT 3" << std::endl;
SimplexVector = {3};
std::clog << " - INSERT (0,3)" << std::endl;
SimplexVector = {0, 3};
std::clog << " - INSERT (0,1) (already inserted)" << std::endl;
SimplexVector = {0, 1};
std::clog << " - INSERT (3,4,5)" << std::endl;
SimplexVector = {3, 4, 5};
std::clog << " - INSERT (0,1,6,7)" << std::endl;
SimplexVector = {0, 1, 6, 7};
std::clog << " - INSERT (4,5,8,9)" << std::endl;
SimplexVector = {4, 5, 8, 9};
std::clog << " - INSERT (9,10,11)" << std::endl;
SimplexVector = {9, 10, 11};
std::clog << " - INSERT (2,10,12)" << std::endl;
SimplexVector = {2, 10, 12};
std::clog << " - INSERT (11,6)" << std::endl;
SimplexVector = {6, 11};
std::clog << " - INSERT (13,14,15)" << std::endl;
SimplexVector = {13, 14, 15};
<< std::endl;
std::clog <<
" - dimension " << st.
dimension() << std::endl;
std::clog << std::endl << std::endl << "Iterator on Simplices in the filtration, with [filtration value]:"
<< std::endl;
std::clog << "**************************************************************" << std::endl;
std::clog << "strict graph G { " << std::endl;
std::clog <<
" " <<
"[" << st.
filtration(f_simplex) <<
"] ";
std::clog << static_cast<int>(vertex) << " -- ";
}
std::clog << ";" << std::endl;
}
std::clog << "}" << std::endl;
std::clog << "**************************************************************" << std::endl;
pcoh.init_coefficients(coeff_field_characteristic);
pcoh.compute_persistent_cohomology(min_persistence);
pcoh.output_diagram();
return 0;
}
Options::Filtration_value Filtration_value
Type for the value of the filtration function.
Definition: Simplex_tree.h:102
std::pair< Simplex_handle, bool > insert_simplex_and_subfaces(const InputVertexRange &Nsimplex, Filtration_value filtration=0)
Insert a N-simplex and all his subfaces, from a N-simplex represented by a range of Vertex_handles,...
Definition: Simplex_tree.h:942
Filtration_simplex_range const & filtration_simplex_range(Indexing_tag=Indexing_tag())
Returns a range over the simplices of the simplicial complex, in the order of the filtration.
Definition: Simplex_tree.h:338
Simplex_vertex_range simplex_vertex_range(Simplex_handle sh) const
Returns a range over the vertices of a simplex.
Definition: Simplex_tree.h:349
static Filtration_value filtration(Simplex_handle sh)
Returns the filtration value of a simplex.
Definition: Simplex_tree.h:614
size_t num_vertices() const
Returns the number of vertices in the complex.
Definition: Simplex_tree.h:651
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
Graph simplicial complex methods.
Value type for a filtration function on a cell complex.
Definition: FiltrationValue.h:20