From 7b850b8ee43fb7f8a0b2a1565ed01102d40b0a14 Mon Sep 17 00:00:00 2001 From: Arnur Nigmetov Date: Mon, 5 Sep 2016 13:32:05 +0200 Subject: Technical changes for R integration Avoid including iostream (R complains about that). All output protected by preprocessor directive (R checker should not see an instance of std::cout << in your code). Also added getWassersteinCost to be in line with the Dionysus implementation used in TDA. --- geom_bottleneck/bottleneck/src/basic_defs.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'geom_bottleneck/bottleneck/src/basic_defs.cpp') diff --git a/geom_bottleneck/bottleneck/src/basic_defs.cpp b/geom_bottleneck/bottleneck/src/basic_defs.cpp index e09b119..76e6cc5 100644 --- a/geom_bottleneck/bottleneck/src/basic_defs.cpp +++ b/geom_bottleneck/bottleneck/src/basic_defs.cpp @@ -20,6 +20,7 @@ #include #include +#include "def_debug_bt.h" #include "basic_defs_bt.h" namespace geom_bt { @@ -36,6 +37,7 @@ bool Point::operator!=(const Point& other) const return !(*this == other); } +#ifndef FOR_R_TDA std::ostream& operator<<(std::ostream& output, const Point p) { output << "(" << p.x << ", " << p.y << ")"; @@ -51,6 +53,7 @@ std::ostream& operator<<(std::ostream& output, const PointSet& ps) output << "\b\b }"; return output; } +#endif double sqrDist(const Point& a, const Point& b) { @@ -90,6 +93,7 @@ bool DiagramPoint::operator!=(const DiagramPoint& other) const return !(*this == other); } +#ifndef FOR_R_TDA std::ostream& operator<<(std::ostream& output, const DiagramPoint p) { if ( p.type == DiagramPoint::DIAG ) { @@ -109,6 +113,7 @@ std::ostream& operator<<(std::ostream& output, const DiagramPointSet& ps) output << "\b\b }"; return output; } +#endif DiagramPoint::DiagramPoint(double xx, double yy, Type ttype, IdType uid) : x(xx), @@ -116,14 +121,8 @@ DiagramPoint::DiagramPoint(double xx, double yy, Type ttype, IdType uid) : type(ttype), id(uid) { - //if ( xx < 0 ) - //throw "Negative x coordinate"; - //if ( yy < 0) - //throw "Negative y coordinate"; - //if ( yy < xx ) - //throw "Point is below the diagonal"; if ( yy == xx and ttype != DiagramPoint::DIAG) - throw "Point on the main diagonal must have DIAG type"; + throw std::runtime_error("Point on the main diagonal must have DIAG type"); } -- cgit v1.2.3