00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef MATRIXAUTOMORPHISMPREDICATE_H_
00034 #define MATRIXAUTOMORPHISMPREDICATE_H_
00035
00036 #include "subgroup_predicate.h"
00037 #include "search/partition/refinement_family.h"
00038
00039 #include <boost/foreach.hpp>
00040
00041 namespace permlib {
00042
00044 template <class PERM,class MATRIX>
00045 class MatrixAutomorphismPredicate : public SubgroupPredicate<PERM> {
00046 public:
00048 MatrixAutomorphismPredicate(const MATRIX& matrix);
00049
00050 virtual bool operator()(const PERM &p) const;
00051 virtual bool childRestriction(const PERM &h, uint i, ulong beta_i) const;
00052 virtual uint limit() const;
00053 private:
00054 const MATRIX& m_matrix;
00055 };
00056
00057
00058
00059
00060
00061 template <class PERM,class MATRIX>
00062 MatrixAutomorphismPredicate<PERM,MATRIX>::MatrixAutomorphismPredicate(const MATRIX& matrix)
00063 : m_matrix(matrix)
00064 { }
00065
00066 template <class PERM,class MATRIX>
00067 bool MatrixAutomorphismPredicate<PERM,MATRIX>::operator()(const PERM &p) const {
00068 const ulong n = m_matrix.dimension();
00069 for (ulong i = 0; i < n; ++i) {
00070 for (ulong j = i; j < n; ++j) {
00071 if (m_matrix.at(i, j) != m_matrix.at(p / i, p / j))
00072 return false;
00073 }
00074 }
00075 return true;
00076 }
00077
00078 template <class PERM,class MATRIX>
00079 bool MatrixAutomorphismPredicate<PERM,MATRIX>::childRestriction(const PERM &h, uint i, ulong beta_i) const {
00080
00081 return true;
00082 }
00083
00084 template <class PERM,class MATRIX>
00085 uint MatrixAutomorphismPredicate<PERM,MATRIX>::limit() const {
00086
00087 return m_matrix.dimension();
00088 }
00089
00090 }
00091
00092 #endif // -- MATRIXAUTOMORPHISMPREDICATE_H_