00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SEMIRING_NUMERICAL_SEMIRING_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SEMIRING_NUMERICAL_SEMIRING_HH
00019
00020 # include <vaucanson/algebra/concept/numerical_semiring.hh>
00021 # include <vaucanson/algebra/implementation/semiring/rational_number.hh>
00022
00023 namespace vcsn {
00024
00025 namespace algebra {
00026
00027 template<typename T>
00028 bool op_contains(const algebra::NumericalSemiring& s, T c);
00029
00030 template<typename T, typename U>
00031 void op_in_mul(const algebra::NumericalSemiring& s1, T& dst, U arg);
00032
00033 template<typename T, typename U>
00034 void op_in_add(const algebra::NumericalSemiring& s1, T& dst, U arg);
00035
00036 template<typename T, typename U>
00037 T op_mul(const algebra::NumericalSemiring& s, T a, U b);
00038
00039 template<typename T, typename U>
00040 T op_add(const algebra::NumericalSemiring& s, T a, U b);
00041
00042 template<typename T>
00043 T identity_value(SELECTOR(algebra::NumericalSemiring), SELECTOR(T));
00044
00045 template<typename T>
00046 T zero_value(SELECTOR(algebra::NumericalSemiring), SELECTOR(T));
00047
00048 template <class T>
00049 Element<algebra::NumericalSemiring, T>
00050 op_choose(const algebra::NumericalSemiring& s, SELECTOR(T));
00051
00052
00053
00054
00055
00056 bool
00057 op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00058 SELECTOR(int));
00059
00060 Element<algebra::NumericalSemiring, int>
00061 op_choose_starable(const algebra::NumericalSemiring& set, SELECTOR(int));
00062
00063 Element<algebra::NumericalSemiring, int>
00064 op_choose_non_starable(const algebra::NumericalSemiring& set,
00065 SELECTOR(int));
00066
00067
00068
00069
00070 template<typename T>
00071 void op_in_mul(const algebra::NumericalSemiring& s1,
00072 bool& dst, bool src);
00073
00074 inline bool op_mul(const algebra::NumericalSemiring& s, bool a, bool b);
00075
00076 inline void op_in_add(const algebra::NumericalSemiring& s1,
00077 bool& dst, bool src);
00078
00079 inline bool op_add(const algebra::NumericalSemiring& s, bool a, bool b);
00080
00081 inline bool identity_value(SELECTOR(algebra::NumericalSemiring),
00082 SELECTOR(bool));
00083
00084 inline bool zero_value(SELECTOR(algebra::NumericalSemiring),
00085 SELECTOR(bool));
00086
00087 inline bool op_starable(const algebra::NumericalSemiring& s, bool b);
00088
00089 inline void op_in_star(const algebra::NumericalSemiring& s, bool& b);
00090
00091 Element<algebra::NumericalSemiring, bool>
00092 op_choose_starable(const algebra::NumericalSemiring& set, SELECTOR(bool));
00093
00094 Element<algebra::NumericalSemiring, bool>
00095 op_choose_non_starable(const algebra::NumericalSemiring& set,
00096 SELECTOR(bool));
00097
00098
00099
00100
00101 template<typename T>
00102 bool op_starable(const algebra::NumericalSemiring& s, T v);
00103
00104 inline bool op_starable(const algebra::NumericalSemiring& s,
00105 const float& f);
00106
00107 inline bool op_starable(const algebra::NumericalSemiring& s,
00108 const double& f);
00109
00110 inline void op_in_star(const algebra::NumericalSemiring& s, float& f);
00111
00112 inline void op_in_star(const algebra::NumericalSemiring& s, double& f);
00113
00114 bool
00115 op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00116 SELECTOR(float));
00117
00118 Element<algebra::NumericalSemiring, float>
00119 op_choose_starable(const algebra::NumericalSemiring& set,
00120 SELECTOR(float));
00121
00122 Element<algebra::NumericalSemiring, float>
00123 op_choose_non_starable(const algebra::NumericalSemiring& set,
00124 SELECTOR(float));
00125
00126 bool
00127 op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00128 SELECTOR(double));
00129
00130 Element<algebra::NumericalSemiring, double>
00131 op_choose_starable(const algebra::NumericalSemiring& set,
00132 SELECTOR(double));
00133
00134 Element<algebra::NumericalSemiring, double>
00135 op_choose_non_starable(const algebra::NumericalSemiring& set,
00136 SELECTOR(double));
00137
00138
00139
00140
00141
00142 inline algebra::RationalNumber
00143 identity_value(SELECTOR(algebra::NumericalSemiring),
00144 SELECTOR(algebra::RationalNumber));
00145
00146 inline algebra::RationalNumber
00147 zero_value(SELECTOR(algebra::NumericalSemiring),
00148 SELECTOR(algebra::RationalNumber));
00149
00150 template<typename T>
00151 bool op_starable(const algebra::NumericalSemiring& s, T v);
00152
00153 inline bool op_starable(const algebra::NumericalSemiring& s,
00154 const algebra::RationalNumber& r);
00155
00156 inline void op_in_star(const algebra::NumericalSemiring& s,
00157 algebra::RationalNumber& r);
00158
00159 bool
00160 op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00161 SELECTOR(algebra::RationalNumber));
00162
00163 Element<algebra::NumericalSemiring, algebra::RationalNumber>
00164 op_choose_starable(const algebra::NumericalSemiring& set,
00165 SELECTOR(algebra::RationalNumber));
00166
00167 Element<algebra::NumericalSemiring, algebra::RationalNumber>
00168 op_choose_non_starable(const algebra::NumericalSemiring& set,
00169 SELECTOR(algebra::RationalNumber));
00170
00171 }
00172
00173 }
00174
00175
00176 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00177 # include <vaucanson/algebra/implementation/semiring/numerical_semiring.hxx>
00178 #endif // VCSN_USE_INTERFACE_ONLY
00179
00180
00181 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SEMIRING_NUMERICAL_SEMIRING_HH