diff options
author | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-03-09 16:43:07 +0100 |
---|---|---|
committer | Arnur Nigmetov <nigmetov@tugraz.at> | 2020-03-09 16:43:07 +0100 |
commit | ca4222ab40f1c6c0d17fb7d43539aa675f640976 (patch) | |
tree | e2a91037ac1d9e8895eafbab54c1c11f0b257c85 /wasserstein/include/hera_infinity.h | |
parent | 7fb44351b487c64f23066a428089ef14a95b4176 (diff) | |
parent | 14e91d6c3ad81a1ec763d75a28f20fb689e5166e (diff) |
Merge README
Diffstat (limited to 'wasserstein/include/hera_infinity.h')
-rw-r--r-- | wasserstein/include/hera_infinity.h | 22 |
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 |