summaryrefslogtreecommitdiff
path: root/fast/semiring.hh
diff options
context:
space:
mode:
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