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 
00102     
00103     inline float op_sub(const algebra::NumericalSemiring&, const float& a, const float& b);
00104 
00105     inline double op_sub(const algebra::NumericalSemiring&, const double& a, const double& b);
00106 
00107     inline float op_div(const algebra::NumericalSemiring&, const float& a, const float& b);
00108 
00109     inline double op_div(const algebra::NumericalSemiring&, const double& a, const double& b);
00110     
00111 
00112     inline bool op_eq(const algebra::NumericalSemiring&, float& a, float& b);
00113 
00114     inline bool op_eq(const algebra::NumericalSemiring&, double& a, double& b);
00115 
00116     template<typename T>
00117     bool op_starable(const algebra::NumericalSemiring& s, T v);
00118 
00119     inline bool op_starable(const algebra::NumericalSemiring& s,
00120                             const float& f);
00121 
00122     inline bool op_starable(const algebra::NumericalSemiring& s,
00123                             const double& f);
00124 
00125     inline void op_in_star(const algebra::NumericalSemiring& s, float& f);
00126 
00127     inline void op_in_star(const algebra::NumericalSemiring& s, double& f);
00128 
00129     bool
00130     op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00131                                 SELECTOR(float));
00132 
00133     Element<algebra::NumericalSemiring, float>
00134     op_choose_starable(const algebra::NumericalSemiring& set,
00135                        SELECTOR(float));
00136 
00137     Element<algebra::NumericalSemiring, float>
00138     op_choose_non_starable(const algebra::NumericalSemiring& set,
00139                            SELECTOR(float));
00140 
00141     bool
00142     op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00143                                 SELECTOR(double));
00144 
00145     Element<algebra::NumericalSemiring, double>
00146     op_choose_starable(const algebra::NumericalSemiring& set,
00147                        SELECTOR(double));
00148 
00149     Element<algebra::NumericalSemiring, double>
00150     op_choose_non_starable(const algebra::NumericalSemiring& set,
00151                            SELECTOR(double));
00152 
00153     
00154 
00155 
00156 
00157     inline algebra::RationalNumber
00158     identity_value(SELECTOR(algebra::NumericalSemiring),
00159                    SELECTOR(algebra::RationalNumber));
00160 
00161     inline algebra::RationalNumber
00162     zero_value(SELECTOR(algebra::NumericalSemiring),
00163                SELECTOR(algebra::RationalNumber));
00164 
00165     template<typename T>
00166     bool op_starable(const algebra::NumericalSemiring& s, T v);
00167 
00168     inline bool op_starable(const algebra::NumericalSemiring& s,
00169                             const algebra::RationalNumber& r);
00170 
00171     inline void op_in_star(const algebra::NumericalSemiring& s,
00172                            algebra::RationalNumber& r);
00173 
00174     bool
00175     op_can_choose_non_starable(const algebra::NumericalSemiring& set,
00176                                SELECTOR(algebra::RationalNumber));
00177 
00178     Element<algebra::NumericalSemiring, algebra::RationalNumber>
00179     op_choose_starable(const algebra::NumericalSemiring& set,
00180                        SELECTOR(algebra::RationalNumber));
00181 
00182     Element<algebra::NumericalSemiring, algebra::RationalNumber>
00183     op_choose_non_starable(const algebra::NumericalSemiring& set,
00184                            SELECTOR(algebra::RationalNumber));
00185 
00186   } 
00187 
00188 } 
00189 
00190 
00191 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00192 # include <vaucanson/algebra/implementation/semiring/numerical_semiring.hxx>
00193 #endif // VCSN_USE_INTERFACE_ONLY
00194 
00195 
00196 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SEMIRING_NUMERICAL_SEMIRING_HH