From e2a2d6cb2eec5a7153d6e895a28c85c49347f644 Mon Sep 17 00:00:00 2001 From: Arnur Nigmetov Date: Tue, 19 Jun 2018 22:51:58 +0200 Subject: Template bug fixed --- geom_bottleneck/include/basic_defs_bt.h | 7 +++---- geom_bottleneck/include/bottleneck_detail.hpp | 12 ++++++------ 2 files changed, 9 insertions(+), 10 deletions(-) (limited to 'geom_bottleneck/include') diff --git a/geom_bottleneck/include/basic_defs_bt.h b/geom_bottleneck/include/basic_defs_bt.h index a26d9a5..6124dbe 100644 --- a/geom_bottleneck/include/basic_defs_bt.h +++ b/geom_bottleneck/include/basic_defs_bt.h @@ -206,8 +206,7 @@ namespace hera { #ifndef FOR_R_TDA - template - friend std::ostream& operator<<(std::ostream& output, const DiagramPoint& p) + friend std::ostream& operator<<(std::ostream& output, const DiagramPoint& p) { if (p.isDiagonal()) { output << "(" << p.x << ", " << p.y << ", " << 0.5 * (p.x + p.y) << ", " << p.id << " DIAG )"; @@ -245,6 +244,7 @@ namespace hera { return 0.0; } // otherwise distance is a usual l-inf distance + // Real dx = (a.getRealX() == b.getRealX()) ? 0.0 : fabs(a.getRealX() - b.getRealX()); Real dy = (a.getRealY() == b.getRealY()) ? 0.0 : fabs(a.getRealY() - b.getRealY()); Real result = std::max(dx, dy); @@ -406,8 +406,7 @@ namespace hera { #ifndef FOR_R_TDA - template - friend std::ostream& operator<<(std::ostream& output, const DiagramPointSet& ps) + friend std::ostream& operator<<(std::ostream& output, const DiagramPointSet& ps) { output << "{ "; for (auto pit = ps.cbegin(); pit != ps.cend(); ++pit) { diff --git a/geom_bottleneck/include/bottleneck_detail.hpp b/geom_bottleneck/include/bottleneck_detail.hpp index 8ec9c68..8f51d07 100644 --- a/geom_bottleneck/include/bottleneck_detail.hpp +++ b/geom_bottleneck/include/bottleneck_detail.hpp @@ -468,7 +468,7 @@ namespace hera { Real distEpsilon = std::numeric_limits::max(); Real diffThreshold = 0.1; for (int k = 0; k < decPrecision; ++k) { - diffThreshold /= 10.0; + diffThreshold /= 10; } for (size_t k = 0; k < pairwiseDist.size() - 2; ++k) { auto diff = pairwiseDist[k + 1] - pairwiseDist[k]; @@ -476,7 +476,7 @@ namespace hera { distEpsilon = diff; } } - distEpsilon = std::min(diffThreshold, distEpsilon / 3.0); + distEpsilon = std::min(diffThreshold, distEpsilon / 3); BoundMatchOracle oracle(A, B, distEpsilon, useRangeSearch); // binary search @@ -484,19 +484,19 @@ namespace hera { size_t idxMin { 0 }, idxMax { pairwiseDist.size() - 1 }; size_t idxMid; while (idxMax > idxMin) { - idxMid = static_cast(floor(idxMin + idxMax) / 2.0); + idxMid = static_cast(floor(idxMin + idxMax) / 2); iterNum++; // not A[imid] < dist <=> A[imid] >= dist <=> A[imid[ >= dist + eps - if (oracle.isMatchLess(pairwiseDist[idxMid] + distEpsilon / 2.0)) { + if (oracle.isMatchLess(pairwiseDist[idxMid] + distEpsilon / 2)) { idxMax = idxMid; } else { idxMin = idxMid + 1; } } - idxMid = static_cast(floor(idxMin + idxMax) / 2.0); + idxMid = static_cast(floor(idxMin + idxMax) / 2); Real result = pairwiseDist[idxMid]; if (compute_longest_edge) { - oracle.isMatchLess(result + distEpsilon / 2.0); + oracle.isMatchLess(result + distEpsilon / 2); longest_edge = oracle.get_longest_edge(); } return result; -- cgit v1.2.3