PersistentLaplacians
PersistentRipsLaplacian.hpp
Go to the documentation of this file.
1 #ifndef PL_R_H
2 #define PL_R_H
3 
4 #include "../core/PersistentLaplacian.hpp"
5 #include "../../include/Ripser_modified/ripser_modified.h"
6 
7 
8 namespace PersistentLaplacians{
9  template <typename eigs_Algorithm, typename up_Algorithm>
10  class PersistentRipsLaplacian : public PersistentLaplacian<eigs_Algorithm, up_Algorithm> {
11  public:
12 
13  // Lower_Distance_Matrix file format
14  PersistentRipsLaplacian(const char* filename, int max_dim) : PersistentLaplacians::PersistentLaplacian<eigs_Algorithm, up_Algorithm>() { // call default constructor of parent class
15  std::vector<std::vector<std::tuple<int64_t,int64_t,int>>> boundaries_triples;
16  std::vector<std::vector<filtration_type>> filtrations;
17  float threshold = std::numeric_limits<value_t>::max();
18  rips_distance_matrix_file(filename, (long long int) max_dim, threshold, boundaries_triples, filtrations);
19 
20  if(boundaries_triples.size() == 0){
21 
22  }
23 
24  std::vector<SparseMatrixInt> reindexed_boundaries(boundaries_triples.size());
25  reindex_boundaries_map(boundaries_triples, reindexed_boundaries, filtrations[0].size());
26  this->set_boundaries_filtrations(reindexed_boundaries, filtrations);
27 
28  }
29 
30  // Point cloud format
31  PersistentRipsLaplacian(const char* filename, int max_dim, float threshold) : PersistentLaplacians::PersistentLaplacian<eigs_Algorithm, up_Algorithm>() { // call default constructor of parent class
32  std::vector<std::vector<std::tuple<int64_t,int64_t,int>>> boundaries_triples;
33  std::vector<std::vector<filtration_type>> filtrations;
34  rips_distance_matrix_file(filename, (long long int) max_dim, threshold, boundaries_triples, filtrations);
35 
36  std::vector<SparseMatrixInt> reindexed_boundaries(boundaries_triples.size());
37 
38  reindex_boundaries_map(boundaries_triples, reindexed_boundaries, filtrations[0].size());
39  this->set_boundaries_filtrations(reindexed_boundaries, filtrations);
40 
41  }
42 
43  // Point cloud format
44  PersistentRipsLaplacian(std::vector<std::vector<double>> points, int max_dim){
45  std::vector<std::vector<std::tuple<int64_t,int64_t,int>>> boundaries_triples;
46  std::vector<std::vector<filtration_type>> filtrations;
47  float threshold = std::numeric_limits<value_t>::max();
48  rips_point_cloud(points, max_dim, threshold, boundaries_triples, filtrations);
49  std::vector<SparseMatrixInt> reindexed_boundaries(boundaries_triples.size());
50 
51  reindex_boundaries_map(boundaries_triples, reindexed_boundaries, filtrations[0].size());
52  this->set_boundaries_filtrations(reindexed_boundaries, filtrations);
53 
54  }
55 
56  PersistentRipsLaplacian(std::vector<std::vector<double>> points, int max_dim, float threshold){
57  std::vector<std::vector<std::tuple<int64_t,int64_t,int>>> boundaries_triples;
58  std::vector<std::vector<filtration_type>> filtrations;
59  rips_point_cloud(points, max_dim, threshold, boundaries_triples, filtrations);
60  std::vector<SparseMatrixInt> reindexed_boundaries(boundaries_triples.size());
61 
62  reindex_boundaries_map(boundaries_triples, reindexed_boundaries, filtrations[0].size());
63  this->set_boundaries_filtrations(reindexed_boundaries, filtrations);
64 
65  }
66  private:
67 
68  };
69 }
70 
71 #endif
Definition: PersistentLaplacian.hpp:30
void set_boundaries_filtrations(std::vector< SparseMatrixInt > boundaries, std::vector< std::vector< filtration_type >> filtrations)
Definition: PersistentLaplacian.hpp:95
Definition: PersistentRipsLaplacian.hpp:10
PersistentRipsLaplacian(const char *filename, int max_dim)
Definition: PersistentRipsLaplacian.hpp:14
PersistentRipsLaplacian(const char *filename, int max_dim, float threshold)
Definition: PersistentRipsLaplacian.hpp:31
PersistentRipsLaplacian(std::vector< std::vector< double >> points, int max_dim, float threshold)
Definition: PersistentRipsLaplacian.hpp:56
PersistentRipsLaplacian(std::vector< std::vector< double >> points, int max_dim)
Definition: PersistentRipsLaplacian.hpp:44
Definition: PersistentLaplacians.cpp:7
void reindex_boundaries_map(std::vector< std::vector< std::tuple< int64_t, int64_t, int >>> &boundaries_triples, std::vector< SparseMatrixInt > &reindexed_boundaries, int dummy_remove)
Definition: PersistentLaplacians.cpp:59