permlib  0.2.9
Library for permutation computations
matrix_automorphism_search.h
1 // ---------------------------------------------------------------------------
2 //
3 // This file is part of PermLib.
4 //
5 // Copyright (c) 2009-2011 Thomas Rehn <thomas@carmen76.de>
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without
9 // modification, are permitted provided that the following conditions
10 // are met:
11 // 1. Redistributions of source code must retain the above copyright
12 // notice, this list of conditions and the following disclaimer.
13 // 2. Redistributions in binary form must reproduce the above copyright
14 // notice, this list of conditions and the following disclaimer in the
15 // documentation and/or other materials provided with the distribution.
16 // 3. The name of the author may not be used to endorse or promote products
17 // derived from this software without specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20 // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21 // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22 // IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23 // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 // NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 
32 
33 #ifndef PARTITION_MATRIX_AUTOMORPHISM_SEARCH_H_
34 #define PARTITION_MATRIX_AUTOMORPHISM_SEARCH_H_
35 
36 #include <permlib/search/partition/r_base.h>
37 #include <permlib/search/partition/matrix_refinement1.h>
38 #include <permlib/search/partition/refinement_family.h>
39 #include <permlib/predicate/matrix_automorphism_predicate.h>
40 
41 namespace permlib {
42 namespace partition {
43 
45 template<class BSGSIN,class TRANSRET>
46 class MatrixAutomorphismSearch : public RBase<BSGSIN,TRANSRET> {
47 public:
48  typedef typename RBase<BSGSIN,TRANSRET>::PERM PERM;
49 
51 
55  MatrixAutomorphismSearch(const BSGSIN& bsgs, unsigned int pruningLevelDCM);
56 
58 
63  template<class MATRIX, class Iterator>
64  void construct(const MATRIX& matrix, Iterator initialPartitionBegin, Iterator initialPartitionEnd);
65 
67 
70  template<class MATRIX>
71  void construct(const MATRIX& matrix) { construct<MATRIX, unsigned int*>(matrix, 0, 0); }
72 };
73 
74 template<class BSGSIN,class TRANSRET>
75 MatrixAutomorphismSearch<BSGSIN,TRANSRET>::MatrixAutomorphismSearch(const BSGSIN& bsgs, unsigned int pruningLevelDCM)
76  : RBase<BSGSIN,TRANSRET>(bsgs, pruningLevelDCM)
77 { }
78 
79 template<class BSGSIN,class TRANSRET>
80 template<class MATRIX, class Iterator>
81 void MatrixAutomorphismSearch<BSGSIN,TRANSRET>::construct(const MATRIX& matrix, Iterator initialPartitionBegin, Iterator initialPartitionEnd) {
83 
84  if (initialPartitionBegin != initialPartitionEnd) {
85  // set up partitions such that the elements of initialPartition will be mapped onto itself
86  RBase<BSGSIN,TRANSRET>::m_partition.intersect(initialPartitionBegin, initialPartitionEnd, 0);
87  RBase<BSGSIN,TRANSRET>::m_partition2.intersect(initialPartitionBegin, initialPartitionEnd, 0);
88  }
89 
92  PERM empty(RBase<BSGSIN,TRANSRET>::m_bsgs.n);
94 
97 }
98 
99 }
100 }
101 
102 #endif // -- PARTITION_MATRIX_AUTOMORPHISM_SEARCH_H_
bool initializeAndApply(Partition &pi)
applies (left-)refinement to partition and initializes refinement for future use in R-base ...
Definition: refinement.h:136
virtual unsigned int apply2(Partition &pi, const PERM &t) const
applies (right-)refinement to pi which is the image of the original partition this refinement was ini...
Definition: refinement.h:156
void construct(const MATRIX &matrix)
initializes search
Definition: matrix_automorphism_search.h:71
predicate for the automorphisms of a symmetric matrix
Definition: matrix_automorphism_predicate.h:45
R-base for partition backtracking.
Definition: r_base.h:56
concrete -refinement for symmetric matrix automorphisms
Definition: matrix_refinement1.h:48
void construct(const MATRIX &matrix, Iterator initialPartitionBegin, Iterator initialPartitionEnd)
initializes search with inital partition
Definition: matrix_automorphism_search.h:81
void construct(SubgroupPredicate< PERM > *pred, RefinementFamily< PERM > *predRefinement)
constructs an R-base for given predicate and refinement family
Definition: r_base.h:115
subgroup search for the automorphism group of a symmetric matrix based on partition backtracking ...
Definition: matrix_automorphism_search.h:46
MatrixAutomorphismSearch(const BSGSIN &bsgs, unsigned int pruningLevelDCM)
constructor
Definition: matrix_automorphism_search.h:75
-refinements for symmetric matrix automorphisms
Definition: refinement_family.h:156
Definition: abstract_bsgs.h:49