diff options
Diffstat (limited to 'geom_bottleneck')
-rw-r--r-- | geom_bottleneck/bottleneck/include/def_debug_bt.h | 1 | ||||
-rw-r--r-- | geom_bottleneck/bottleneck/src/bottleneck.cpp | 11 | ||||
-rw-r--r-- | geom_bottleneck/bottleneck/src/bound_match.cpp | 19 |
3 files changed, 27 insertions, 4 deletions
diff --git a/geom_bottleneck/bottleneck/include/def_debug_bt.h b/geom_bottleneck/bottleneck/include/def_debug_bt.h index 60f834e..888ded6 100644 --- a/geom_bottleneck/bottleneck/include/def_debug_bt.h +++ b/geom_bottleneck/bottleneck/include/def_debug_bt.h @@ -29,5 +29,6 @@ // for R package TDA, to comply with some CRAN rules // like no usage of cout, cerr, cin, exit, etc. //#define FOR_R_TDA +//#define VERBOSE_BOTTLENECK #endif diff --git a/geom_bottleneck/bottleneck/src/bottleneck.cpp b/geom_bottleneck/bottleneck/src/bottleneck.cpp index da0c425..f90e5c9 100644 --- a/geom_bottleneck/bottleneck/src/bottleneck.cpp +++ b/geom_bottleneck/bottleneck/src/bottleneck.cpp @@ -208,10 +208,15 @@ std::pair<double, double> bottleneckDistApproxIntervalHeur(DiagramPointSet& A, D DiagramPointSet sampledA, sampledB; sampleDiagramForHeur(A, sampledA); sampleDiagramForHeur(B, sampledB); - //std::cout << "A : " << A.size() << ", sampled: " << sampledA.size() << std::endl; - //std::cout << "B : " << B.size() << ", sampled: " << sampledB.size() << std::endl; +#ifdef VERBOSE_BOTTLENECK + std::cout << "A : " << A.size() << ", sampled: " << sampledA.size() << std::endl; + std::cout << "B : " << B.size() << ", sampled: " << sampledB.size() << std::endl; +#endif std::pair<double, double> initGuess = bottleneckDistApproxInterval(sampledA, sampledB, epsilon); - //std::cout << "initial guess: " << initGuess.first << ", " << initGuess.second << std::endl; +#ifdef VERBOSE_BOTTLENECK + std::cout << "initial guess with sampling: " << initGuess.first << ", " << initGuess.second << std::endl; + std::cout << "running on the original diagrams" << std::endl; +#endif return bottleneckDistApproxIntervalWithInitial(A, B, epsilon, initGuess); } diff --git a/geom_bottleneck/bottleneck/src/bound_match.cpp b/geom_bottleneck/bottleneck/src/bound_match.cpp index a9ec93a..a95ee60 100644 --- a/geom_bottleneck/bottleneck/src/bound_match.cpp +++ b/geom_bottleneck/bottleneck/src/bound_match.cpp @@ -21,6 +21,11 @@ along with GeomBottleneck. If not, see <http://www.gnu.org/licenses/>. #include <assert.h> #include "def_debug_bt.h" #include "bound_match.h" + +#ifdef VERBOSE_BOTTLENECK +#include <chrono> +#endif + #ifndef FOR_R_TDA #include <iostream> #endif @@ -245,7 +250,19 @@ BoundMatchOracle::BoundMatchOracle(DiagramPointSet psA, DiagramPointSet psB, bool BoundMatchOracle::isMatchLess(double r) { - return buildMatchingForThreshold(r); +#ifdef VERBOSE_BOTTLENECK + std::chrono::high_resolution_clock hrClock; + std::chrono::time_point<std::chrono::high_resolution_clock> startMoment; + startMoment = hrClock.now(); +#endif + bool result = buildMatchingForThreshold(r); +#ifdef VERBOSE_BOTTLENECK + auto endMoment = hrClock.now(); + std::chrono::duration<double, std::milli> iterTime = endMoment - startMoment; + std::cout << "isMatchLess for r = " << r << " finished in " << std::chrono::duration<double, std::milli>(iterTime).count() << " ms." << std::endl; +#endif + return result; + } |