tropical_semiring.hh

00001 // tropical_semiring.hh: this file is part of the Vaucanson project.
00002 //
00003 // Vaucanson, a generic library for finite state machines.
00004 //
00005 // Copyright (C) 2001, 2002, 2003, 2004, 2005 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_ALGEBRA_IMPLEMENTATION_SEMIRING_TROPICAL_SEMIRING_HH
00018 # define VCSN_ALGEBRA_IMPLEMENTATION_SEMIRING_TROPICAL_SEMIRING_HH
00019 
00020 # include <vaucanson/algebra/concept/tropical_semiring.hh>
00021 
00022 namespace vcsn {
00023 
00024     // We provide a generic implementation of tropical semirings
00025     // formed with C++-builtins and standard operations (std::min,
00026     // std::max, +).
00027 
00028     /*---------------.
00029     | Identity value |
00030     `---------------*/
00031     template<class TropicalKind, typename T>
00032     T identity_value(SELECTOR(algebra::TropicalSemiring<TropicalKind>), SELECTOR(T));
00033 
00034     template<typename T>
00035     T zero_value(SELECTOR(algebra::TropicalSemiring<algebra::TropicalMax>), SELECTOR(T));
00036 
00037     template<typename T>
00038     T zero_value(SELECTOR(algebra::TropicalSemiring<algebra::TropicalMin>), SELECTOR(T));
00039 
00040     /*------------.
00041     | op_contains |
00042     `------------*/
00043     template<class TropicalKind, typename T>
00044     bool op_contains(const algebra::TropicalSemiring<TropicalKind>& s, T c);
00045 
00046     /*--------------------.
00047     | Multiplication is + |
00048     `--------------------*/
00049     template<class TropicalKind, typename T, typename U>
00050     void op_in_mul(const algebra::TropicalSemiring<TropicalKind>& s1,
00051                    T& dst, U arg);
00052 
00053     template<class TropicalKind, typename T, typename U>
00054     T op_mul(const algebra::TropicalSemiring<TropicalKind>& s, T a, U b);
00055 
00056     /*---------.
00057     | Addition |
00058     `---------*/
00059     template<typename T, typename U>
00060     void op_in_add(const algebra::TropicalSemiring<algebra::TropicalMax>& s1,
00061                    T& dst, U arg);
00062 
00063     template<typename T, typename U>
00064     void op_in_add(const algebra::TropicalSemiring<algebra::TropicalMin>& s1,
00065                    T& dst, U arg);
00066 
00067     template<typename T, typename U>
00068     T op_add(const algebra::TropicalSemiring<algebra::TropicalMax>& s, T a, U b);
00069 
00070     template<typename T, typename U>
00071     T op_add(const algebra::TropicalSemiring<algebra::TropicalMin>& s, T a, U b);
00072 
00073     /*-----.
00074     | Star |
00075     `-----*/
00076     template <typename T>
00077     bool
00078     op_starable(const algebra::TropicalSemiring<algebra::TropicalMin>&, T b);
00079 
00080     template <class T>
00081     void
00082     op_in_star(const algebra::TropicalSemiring<algebra::TropicalMin>& s, T& b);
00083 
00084     template <typename T>
00085     bool
00086     op_starable(const algebra::TropicalSemiring<algebra::TropicalMax>&, T b);
00087 
00088     template <class T>
00089     void
00090     op_in_star(const algebra::TropicalSemiring<algebra::TropicalMax>&, T& b);
00091 
00092     template <class TropicalKind, class T>
00093     Element<algebra::TropicalSemiring<TropicalKind>, T>
00094     op_choose(const algebra::TropicalSemiring<TropicalKind>& set, SELECTOR(T));
00095 
00096     template <class TropicalKind, typename T>
00097     bool
00098     op_can_choose_non_starable(const algebra::TropicalSemiring<TropicalKind>& set,
00099                             SELECTOR(T));
00100 
00101     template <class TropicalKind, typename T>
00102     Element<algebra::TropicalSemiring<TropicalKind>, T>
00103     op_choose_starable(const algebra::TropicalSemiring<TropicalKind>& set,
00104                         SELECTOR(T));
00105 
00106     template <class TropicalKind, typename T>
00107     Element<algebra::TropicalSemiring<TropicalKind>, T>
00108     op_choose_non_starable(const algebra::TropicalSemiring<TropicalKind>& set,
00109                             SELECTOR(T));
00110 
00111     /*---------------.
00112     | Pretty printer |
00113     `---------------*/
00114     template<typename St, typename T>
00115     St& op_rout(const algebra::TropicalSemiring<algebra::TropicalMax>& s,
00116                 St& st, const T& v);
00117 
00118     template<typename St, typename T>
00119     St& op_rout(const algebra::TropicalSemiring<algebra::TropicalMin>& s,
00120                 St& st, const T& v);
00121 
00122 //  } // algebra
00123 
00124 } // vcsn
00125 
00126 
00127 # if !defined VCSN_USE_INTERFACE_ONLY || defined VCSN_USE_LIB
00128 #  include <vaucanson/algebra/implementation/semiring/tropical_semiring.hxx>
00129 # endif // VCSN_USE_INTERFACE_ONLY
00130 
00131 
00132 #endif // ! VCSN_ALGEBRA_IMPLEMENTATION_SEMIRING_TROPICAL_SEMIRING_HH

Generated on Sun Jul 29 19:35:31 2007 for Vaucanson by  doxygen 1.5.2