summaryrefslogtreecommitdiff
path: root/src/Witness_complex/include
diff options
context:
space:
mode:
authorskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-01-17 22:58:28 +0000
committerskachano <skachano@636b058d-ea47-450e-bf9e-a15bfbe3eedb>2017-01-17 22:58:28 +0000
commitf6992f0e5eb53d67a567ee0f12d2c16099bcaf1b (patch)
tree14731c2bbd0f4d7bec8bf94d814470c1b9185fda /src/Witness_complex/include
parentbe4e9ebd24f48def07f6dfec1a46791321fbaee4 (diff)
Added a non-Euclidean version of Witness. Compiles, but doesn't work
git-svn-id: svn+ssh://scm.gforge.inria.fr/svnroot/gudhi/branches/relaxed-witness@1943 636b058d-ea47-450e-bf9e-a15bfbe3eedb Former-commit-id: a825e1ad183ae40170414038e70ce37d38e09689
Diffstat (limited to 'src/Witness_complex/include')
-rw-r--r--src/Witness_complex/include/gudhi/Witness_complex.h68
1 files changed, 19 insertions, 49 deletions
diff --git a/src/Witness_complex/include/gudhi/Witness_complex.h b/src/Witness_complex/include/gudhi/Witness_complex.h
index 56ea8613..22f0f590 100644
--- a/src/Witness_complex/include/gudhi/Witness_complex.h
+++ b/src/Witness_complex/include/gudhi/Witness_complex.h
@@ -47,37 +47,22 @@ namespace witness_complex {
* href="http://doc.cgal.org/latest/Kernel_d/classCGAL_1_1Epick__d.html">CGAL::Epick_d</a> class, which
* can be static if you know the ambiant dimension at compile-time, or dynamic if you don't.
*/
-template< class Kernel_ >
+template< class Nearest_landmark_table_ >
class Witness_complex {
private:
- typedef Kernel_ K;
- typedef typename K::Point_d Point_d;
- typedef typename K::FT FT;
- typedef std::vector<Point_d> Point_range;
- typedef gss::Kd_tree_search<Kernel_, Point_range> Kd_tree;
- typedef typename Kd_tree::INS_range Nearest_landmark_range;
- //typedef typename std::vector<Nearest_landmark_range> Nearest_landmark_table;
- //typedef typename Nearest_landmark_range::iterator Nearest_landmark_row_iterator;
-
- typedef std::vector< double > Point_t;
- typedef std::vector< Point_t > Point_Vector;
-
- typedef FT Filtration_value;
-
-
- typedef std::size_t Witness_id;
- typedef typename Nearest_landmark_range::Point_with_transformed_distance Id_distance_pair;
- typedef typename Id_distance_pair::first_type Landmark_id;
- typedef Active_witness<Id_distance_pair, Nearest_landmark_range> ActiveWitness;
- typedef std::list< ActiveWitness > ActiveWitnessList;
- typedef std::vector< Landmark_id > typeVectorVertex;
- typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex;
+ typedef typename Nearest_landmark_table_::value_type Nearest_landmark_range;
+ typedef std::size_t Witness_id;
+ typedef std::size_t Landmark_id;
+ typedef std::pair<Landmark_id, double> Id_distance_pair;
+ typedef Active_witness<Id_distance_pair, Nearest_landmark_range> ActiveWitness;
+ typedef std::list< ActiveWitness > ActiveWitnessList;
+ typedef std::vector< Landmark_id > typeVectorVertex;
+ typedef std::pair< typeVectorVertex, Filtration_value> typeSimplex;
typedef Landmark_id Vertex_handle;
private:
- Point_range witnesses_, landmarks_;
- Kd_tree landmark_tree_;
+ Nearest_landmark_table_& nearest_landmark_table_;
public:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -92,22 +77,13 @@ private:
* table internally, as well as witnesses from the range 'witnesses'.
* Both ranges should have value_type Kernel_::Point_d.
*/
- template< typename LandmarkRange,
- typename WitnessRange >
- Witness_complex(const LandmarkRange & landmarks,
- const WitnessRange & witnesses)
- : witnesses_(witnesses), landmarks_(landmarks), landmark_tree_(landmarks_)
+
+ Witness_complex(Nearest_landmark_table_ & nearest_landmark_table)
+ : nearest_landmark_table_(nearest_landmark_table)
{
}
- /** \brief Returns the point corresponding to the given vertex.
- * @param[in] vertex Vertex handle of the point to retrieve.
- */
- Point_d get_point( Vertex_handle vertex ) const
- {
- return landmarks_[vertex];
- }
-
+
/** \brief Outputs the (weak) witness complex of relaxation 'max_alpha_square'
* in a simplicial complex data structure.
* \details The function returns true if the construction is successful and false otherwise.
@@ -119,10 +95,10 @@ private:
*/
template < typename SimplicialComplexForWitness >
bool create_complex(SimplicialComplexForWitness& complex,
- FT max_alpha_square,
+ double max_alpha_square,
Landmark_id limit_dimension = std::numeric_limits<Landmark_id>::max())
{
- std::size_t nbL = landmarks_.size();
+ // std::size_t nbL = landmarks_.size();
if (complex.num_vertices() > 0) {
std::cerr << "Witness complex cannot create complex - complex is not empty.\n";
return false;
@@ -137,15 +113,9 @@ private:
}
typeVectorVertex vv;
ActiveWitnessList active_witnesses;
- for (unsigned i = 0; i != nbL; ++i) {
- // initial fill of 0-dimensional simplices
- // by doing it we don't assume that landmarks are necessarily witnesses themselves anymore
- vv = {i};
- complex.insert_simplex(vv, Filtration_value(0.0));
- }
- Landmark_id k = 1; /* current dimension in iterative construction */
- for (auto w: witnesses_)
- active_witnesses.push_back(ActiveWitness(landmark_tree_.query_incremental_nearest_neighbors(w)));
+ Landmark_id k = 0; /* current dimension in iterative construction */
+ for (auto w: nearest_landmark_table_)
+ active_witnesses.push_back(ActiveWitness(w));
ActiveWitness aw_copy(active_witnesses.front());
while (!active_witnesses.empty() && k <= limit_dimension ) {
typename ActiveWitnessList::iterator aw_it = active_witnesses.begin();