diff options
author | Arnur Nigmetov <a.nigmetov@gmail.com> | 2017-04-24 21:55:17 +0200 |
---|---|---|
committer | Arnur Nigmetov <a.nigmetov@gmail.com> | 2017-04-24 21:55:17 +0200 |
commit | 8fb72abe8d5eb4fe715b69545422b16655cc1ec3 (patch) | |
tree | 477e9964296a1d7b2690fbaf9a6b02dcf99feee1 /geom_bottleneck/bottleneck | |
parent | ad723189c90c37ffdba34c2db5c764ceb2192086 (diff) |
Lots of debug output for sampling heuristic
To fix a problem on Mac OS.
Diffstat (limited to 'geom_bottleneck/bottleneck')
-rw-r--r-- | geom_bottleneck/bottleneck/src/bottleneck.cpp | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/geom_bottleneck/bottleneck/src/bottleneck.cpp b/geom_bottleneck/bottleneck/src/bottleneck.cpp index f90e5c9..05e0e27 100644 --- a/geom_bottleneck/bottleneck/src/bottleneck.cpp +++ b/geom_bottleneck/bottleneck/src/bottleneck.cpp @@ -93,6 +93,9 @@ std::pair<double, double> bottleneckDistApproxInterval(DiagramPointSet& A, Diagr void sampleDiagramForHeur(const DiagramPointSet& dgmIn, DiagramPointSet& dgmOut) { +#ifdef VERBOSE_BOTTLENECK + std::cout << "Entered sampleDiagramForHeur, dgmIn.size = " << dgmIn.size() << std::endl; +#endif struct pair_hash { std::size_t operator()(const std::pair<double, double> p) const { @@ -105,7 +108,10 @@ void sampleDiagramForHeur(const DiagramPointSet& dgmIn, DiagramPointSet& dgmOut) m[std::make_pair(ptIter->getRealX(), ptIter->getRealY())]++; } } - if (m.size() < 2) { +#ifdef VERBOSE_BOTTLENECK + std::cout << "map filled in, m.size = " << m.size() << std::endl; +#endif + if (m.size() < 2) { dgmOut = dgmIn; return; } @@ -113,7 +119,13 @@ void sampleDiagramForHeur(const DiagramPointSet& dgmIn, DiagramPointSet& dgmOut) for(const auto& ptQtyPair : m) { v.push_back(ptQtyPair.second); } +#ifdef VERBOSE_BOTTLENECK + std::cout << "v filled in, v.size = " << v.size() << std::endl; +#endif std::sort(v.begin(), v.end()); +#ifdef VERBOSE_BOTTLENECK + std::cout << "v sorted" << std::endl; +#endif int maxLeap = v[1] - v[0]; int cutVal = v[0]; for(int i = 1; i < v.size() - 1; ++i) { @@ -123,7 +135,10 @@ void sampleDiagramForHeur(const DiagramPointSet& dgmIn, DiagramPointSet& dgmOut) cutVal = v[i]; } } - std::vector<std::pair<double, double>> vv; +#ifdef VERBOSE_BOTTLENECK + std::cout << "cutVal found, cutVal = " << cutVal << std::endl; +#endif + std::vector<std::pair<double, double>> vv; // keep points whose multiplicites are at most cutVal // quick-and-dirty: fill in vv with copies of each point // to construct DiagramPointSet from it later @@ -134,8 +149,14 @@ void sampleDiagramForHeur(const DiagramPointSet& dgmIn, DiagramPointSet& dgmOut) } } } +#ifdef VERBOSE_BOTTLENECK + std::cout << "vv filled in, vv.size = " << v.size() << std::endl; +#endif dgmOut.clear(); dgmOut = DiagramPointSet(vv.begin(), vv.end()); +#ifdef VERBOSE_BOTTLENECK + std::cout << "dgmOut filled in, dgmOut.size = " << dgmOut.size() << std::endl; +#endif } @@ -714,8 +735,10 @@ bool readDiagramPointSet(const char* fname, std::vector<std::pair<double, double result.push_back(std::make_pair(x,y)); } else { #ifndef FOR_R_TDA +#ifndef VERBOSE_BOTTLENECK std::cerr << "Warning: in file " << fname << ", line number " << lineNumber << ", zero persistence point ignored: \"" << line << "\"" << std::endl; #endif +#endif } } f.close(); |