From f219bab21c07d02e7e54d557e23387bd93c9ce5f Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 19 Jul 2014 08:30:43 +0200 Subject: hg io --- fast/semiring.hh | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'fast/semiring.hh') 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 -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 T -ViterbiSemiring::add(T x, T y) +Viterbi::add(T x, T y) { return max(x, y); } template T -ViterbiSemiring::multiply(T x, T y) +Viterbi::multiply(T x, T y) { return x * y; } template T -ViterbiSemiring::convert(T x) +Viterbi::convert(T x) { return (T)x; } -#endif +} // namespace -- cgit v1.2.3