finitediff
MgenericPermutation.h
Go to the documentation of this file.
1 /*
2 Copyright 2017 Laurent Claessens
3 contact : laurent@claessens-donadello.eu
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef __MGENERICPERMUTATION_H__238823794
20 #define __MGENERICPERMUTATION_H__238823794
21 
22 
23 
24 //forward
25 template <unsigned int>
27 
47 template <unsigned int tp_size>
49 {
50  public:
51 
52  // For computing the image :
53  // - each subclass define its own `image` member function.
54  //
55  // - The operator () is defined here
56  //
57  // - The member function `at` has not to be defined for each
58  // subclass because it makes no sense for an elementary permutation.
59  //
60  // TODO : the latter is not really true. We could define `at` for
61  // everyone using the `SpecialValue` trick.
62 
64  virtual unsigned int operator()(const unsigned int k) const final;
66  virtual unsigned int image(const unsigned int k) const=0;
67 
68 };
69 
70 template <unsigned int tp_size>
71 unsigned int MgenericPermutation<tp_size>::operator()(const unsigned int k) const
72 {
73  return image(k);
74 }
75 
76 #endif
virtual unsigned int image(const unsigned int k) const =0
virtual unsigned int operator()(const unsigned int k) const final
Definition: MgenericPermutation.h:71
A permutation is a bijection of a finite subset of N.
Definition: MgenericPermutation.h:48
Definition: MelementaryPermutation.h:34