summaryrefslogtreecommitdiff
path: root/geom_bottleneck/bottleneck/src/basic_defs.cpp
diff options
context:
space:
mode:
authorArnur Nigmetov <a.nigmetov@gmail.com>2016-09-05 13:32:05 +0200
committerArnur Nigmetov <a.nigmetov@gmail.com>2016-09-05 13:32:05 +0200
commit7b850b8ee43fb7f8a0b2a1565ed01102d40b0a14 (patch)
tree171852c6acd2c8be4390c53a52debf70ca4930b3 /geom_bottleneck/bottleneck/src/basic_defs.cpp
parentd1cf630f193cff61c83999600550634032ed1739 (diff)
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.
Diffstat (limited to 'geom_bottleneck/bottleneck/src/basic_defs.cpp')
-rw-r--r--geom_bottleneck/bottleneck/src/basic_defs.cpp13
1 files changed, 6 insertions, 7 deletions
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 <algorithm>
#include <cfloat>
+#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");
}