- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

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