Vaucanson 1.4
evaluation_fmp.hxx
00001 // evaluation_fmp.hxx: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2005, 2006, 2008, 2011 The Vaucanson Group.
00006 //
00007 // This program is free software; you can redistribute it and/or
00008 // modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2
00010 // of the License, or (at your option) any later version.
00011 //
00012 // The complete GNU General Public Licence Notice can be found as the
00013 // `COPYING' file in the root directory.
00014 //
00015 // The Vaucanson Group consists of people listed in the `AUTHORS' file.
00016 //
00017 #ifndef VCSN_ALGORITHMS_EVALUATION_FMP_HXX
00018 # define VCSN_ALGORITHMS_EVALUATION_FMP_HXX
00019 
00020 # include <vaucanson/algorithms/evaluation_fmp.hh>
00021 # include <vaucanson/algorithms/image.hh>
00022 # include <vaucanson/algorithms/normalized_composition.hh>
00023 # include <vaucanson/algorithms/sub_normalize.hh>
00024 # include <vaucanson/algebra/concept/freemonoid_product.hh>
00025 
00026 namespace vcsn
00027 {
00028   template <typename S1, typename S2, typename S3,
00029             typename M1, typename M2, typename M3, typename M4,
00030             typename trans_t, typename auto_t, typename res_t>
00031   void
00032   do_evaluation_fmp(const AutomataBase<S1>&,
00033                     const algebra::FreeMonoidProduct<M1, M2>&,
00034                     const AutomataBase<S2>&, const algebra::FreeMonoid<M3>&,
00035                     const AutomataBase<S3>&, const algebra::FreeMonoid<M4>&,
00036                     const trans_t& trans, const auto_t& aut, res_t& res)
00037   {
00038     precondition(is_sub_normalized(trans));
00039     precondition(is_realtime(aut));
00040     trans_t id_aut(trans.structure());
00041     identity(aut, id_aut);
00042     trans_t res_composition = compose(id_aut, trans);
00043     image(res_composition, res);
00044   }
00045 
00046   // FIXME: we should empty res.
00047   template <typename ST, typename TT>
00048   void
00049   evaluation_fmp(const Element<ST, TT>& trans,
00050                  const typename input_projection_helper<ST, TT>::ret& aut,
00051                  typename output_projection_helper<ST, TT>::ret& res)
00052   {
00053     BENCH_TASK_SCOPED("evaluation_fmp");
00054     do_evaluation_fmp(trans.structure(), trans.structure().series().monoid(),
00055                       aut.structure(), aut.structure().series().monoid(),
00056                       res.structure(), res.structure().series().monoid(),
00057                       trans, aut, res);
00058   }
00059 
00060 } // End of namespace vcsn.
00061 #endif // ! VCSN_ALGORITHMS_EVALUATION_FMP_HXX