summaryrefslogtreecommitdiff
path: root/fast/semiring.hh
diff options
context:
space:
mode:
authorPatrick Simianer <p@simianer.de>2014-07-19 08:30:43 +0200
committerPatrick Simianer <p@simianer.de>2014-07-19 08:30:43 +0200
commitf219bab21c07d02e7e54d557e23387bd93c9ce5f (patch)
tree14a6e2b647a3b1ab11391c154fbcf7c63841f8db /fast/semiring.hh
parent6208c48407c359819945730006edf4c402b7ff77 (diff)
hg io
Diffstat (limited to 'fast/semiring.hh')
-rw-r--r--fast/semiring.hh29
1 files changed, 14 insertions, 15 deletions
diff --git a/fast/semiring.hh b/fast/semiring.hh
index 2be19ea..5874e88 100644
--- a/fast/semiring.hh
+++ b/fast/semiring.hh
@@ -1,37 +1,36 @@
-#ifndef SEMIRING_HH
-#define SEMIRING_HH
-//#pragma once
+#pragma once
+
+namespace Semiring {
template<typename T>
-class ViterbiSemiring {
- public:
- T one = 1.0;
- T null = 0.0;
-
- T add(T x, T y);
- T multiply(T x, T y);
- T convert(T x);
+struct Viterbi {
+ T one = 1.0;
+ T null = 0.0;
+
+ T add(T x, T y);
+ T multiply(T x, T y);
+ T convert(T x);
};
template<typename T> T
-ViterbiSemiring<T>::add(T x, T y)
+Viterbi<T>::add(T x, T y)
{
return max(x, y);
}
template<typename T> T
-ViterbiSemiring<T>::multiply(T x, T y)
+Viterbi<T>::multiply(T x, T y)
{
return x * y;
}
template<typename T> T
-ViterbiSemiring<T>::convert(T x)
+Viterbi<T>::convert(T x)
{
return (T)x;
}
-#endif
+} // namespace