17 #ifndef VCSN_ALGEBRA_IMPLEMENTATION_SERIES_GENERALIZED_HXX
18 # define VCSN_ALGEBRA_IMPLEMENTATION_SERIES_GENERALIZED_HXX
21 # include <vaucanson/algebra/concept/series_base.hh>
22 # include <vaucanson/algebra/implementation/series/polynoms.hh>
23 # include <vaucanson/algebra/implementation/series/krat.hh>
32 template<
typename W,
typename M,
typename Tm,
typename Tw>
33 rat::exp<Tm, Tw> op_convert(
const algebra::Series<W, M>& s1,
35 const algebra::Series<W, M>& s2,
36 const algebra::polynom<Tm, Tw>& p_value)
38 precondition(& s1 == & s2);
40 typedef rat::exp<Tm, Tw> kexp_t;
43 if (p_value == identity_value(
SELECT2(algebra::Series<W, M>),
44 SELECT2(algebra::polynom<Tm, Tw>)))
47 if (p_value == zero_value(
SELECT2(algebra::Series<W, M>),
48 SELECT2(algebra::polynom<Tm, Tw>)))
49 return kexp_t::zero();
51 for (
typename algebra::polynom<Tm, Tw>::const_iterator p = p_value.begin();
54 if (exp == kexp_t::zero())
55 exp = (*p).second * kexp_t::constant((*p).first);
57 exp += (*p).second * kexp_t::constant((*p).first);
65 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SERIES_GENERALIZED_HXX