summaryrefslogtreecommitdiff
path: root/wasserstein/include/hera_infinity.h
diff options
context:
space:
mode:
authorArnur Nigmetov <nigmetov@tugraz.at>2019-12-03 20:34:28 +0100
committerArnur Nigmetov <nigmetov@tugraz.at>2019-12-03 20:34:28 +0100
commit29ed61e4dd575edc9960cc6414ab2e20c02a62e1 (patch)
tree4134a502f4a91c6c8a8fcc37cd24897445dbf1e3 /wasserstein/include/hera_infinity.h
parent5a59cfad45c155f8af89c2c6d82db2848d52a953 (diff)
Rename directories for bottleneck and Wasserstein
Diffstat (limited to 'wasserstein/include/hera_infinity.h')
-rw-r--r--wasserstein/include/hera_infinity.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/wasserstein/include/hera_infinity.h b/wasserstein/include/hera_infinity.h
new file mode 100644
index 0000000..8d86dbb
--- /dev/null
+++ b/wasserstein/include/hera_infinity.h
@@ -0,0 +1,22 @@
+#ifndef WASSERSTEIN_HERA_INFINITY_H
+#define WASSERSTEIN_HERA_INFINITY_H
+
+// we cannot assume that template parameter Real will always provide infinity() value,
+// so value -1.0 is used to encode infinity (l_inf norm is used by default)
+
+namespace hera {
+
+ template<class Real = double>
+ inline bool is_infinity(const Real& x)
+ {
+ return x == Real(-1);
+ };
+
+ template<class Real = double>
+ inline constexpr Real get_infinity()
+ {
+ return Real(-1);
+ }
+}
+
+#endif //WASSERSTEIN_HERA_INFINITY_H