atlas  0.6
permutations.h
Go to the documentation of this file.
1
5 /*
6  Copyright (C) 2004,2005 Fokko du Cloux
7  part of the Atlas of Lie Groups and Representations
8
10 */
11
12 #ifndef PERMUTATIONS_H /* guard against multiple inclusions */
13 #define PERMUTATIONS_H
14
15 #include "permutations_fwd.h"
16
17 #include <vector>
18 #include <algorithm>
19
20 #include "bitset_fwd.h"
21 #include "bitmap_fwd.h"
22 #include "matrix_fwd.h"
23
24 /******** type declarations *************************************************/
25
26 namespace atlas {
27
28 namespace permutations {
29
30 template<typename T>
31  inline size_t find_index(const std::vector<T>& v, const T& x)
32  { return std::find(v.begin(),v.end(),x)-v.begin(); }
33
35  : public std::vector<unsigned long>
36  {
37  typedef std::vector<unsigned long> Base;
38  Permutation() : Base() {} // empty
39  Permutation(unsigned long n) : Base(n) {} // dimensioned only
40  Permutation(unsigned long n, int unsused); // identity
41  Permutation(const Permutation& pi, int unused); // inverse
42  template<typename I> Permutation(I b,I e) : Base(b,e) {} // range copy
43
44  // right-compose with |*this|
45  template<typename T> // any assignable type
46  std::vector<T> pull_back(const std::vector<T>& v) const;
47
48  template<size_t n>
50
51  // left-compose with |*this|
52  template<typename U> // unsigned integral type
53  std::vector<U> renumbering(const std::vector<U>& v) const;
54
56
57  // left-multiply by |*this|; imperative version of |renumbering|
58  template<typename U> void renumber(std::vector<U>& v) const;
59
60  // left-multiply by |*this|, but allowing an exception value
61  template<typename U> void renumber(std::vector<U>& v, U except) const;
62
63  // right-compose with the inverse of the permutation (defining a left action)
64  template<typename T> void permute(std::vector<T>& v) const;
65
66  // conjugate by pemutation matrix (to coordinates on permute(standard basis))
67  template<typename T> void conjugate(matrix::Matrix_base<T>& M) const;
68
69  // inverse conjugate by basis pemutation (to coordinates on (e_pi[i])_i)
70  template<typename T> void inv_conjugate(matrix::Matrix_base<T>& M) const;
71
72  };
73
74
75 /******** free standing function declarations *****************************/
76
77  int sign(const Permutation& pi); // signature of permutation
78
79  void compose(Permutation&, const Permutation&, unsigned long n = 0);
80
81  template<typename U>
82  Permutation standardization(const std::vector<U>& a, size_t bound,
83  std::vector<unsigned int>* stops = NULL);
84
85  // a right action on columns: produce columns \$(M.column(pi[j]))_j\$
86  template<typename T>
88
89  template<typename T>
91
92  } // |namespace permutations|
93
94 } // |namespace atlas|
95
96 /********* template definitions with implicit instantiations ******/
97
98 #include "permutations_def.h"
99
100 #endif
std::vector< U > renumbering(const std::vector< U > &v) const
Definition: permutations.cpp:59
void permute_columns(matrix::Matrix_base< T > &M, const Permutation &pi)
Definition: permutations.cpp:140
Definition: Atlas.h:79
std::vector< T > pull_back(const std::vector< T > &v) const
Definition: permutations_def.h:35
Set of n bits.
Definition: Atlas.h:57
Definition: permutations.h:34
std::vector< unsigned long > Base
Definition: permutations.h:37
int sign(const Permutation &pi)
Definition: permutations.cpp:121
Permutation standardization(const std::vector< U > &a, size_t bound, std::vector< unsigned int > *stops)
Definition: permutations.cpp:228
size_t find_index(const std::vector< T > &v, const T &x)
Definition: permutations.h:31
void conjugate(matrix::Matrix_base< T > &M) const
Definition: permutations.cpp:180
Type definitions for the class BitSet.
void compose(Permutation &a, const Permutation &b, unsigned long n)
Definition: permutations.cpp:82
void renumber(std::vector< U > &v) const
Definition: permutations.cpp:102
Permutation(unsigned long n)
Definition: permutations.h:39
void permute(std::vector< T > &v) const
Definition: permutations_def.h:64
unsigned long n
Definition: axis.cpp:77
Definition: Atlas.h:38
Permutation()
Definition: permutations.h:38
void permute_rows(matrix::Matrix_base< T > &M, const Permutation &pi)
Container of a large (more than twice the machine word size) set of bits.
Definition: bitmap.h:52
const expr & e
Definition: axis.cpp:95
Permutation(I b, I e)
Definition: permutations.h:42
Vertex v
Definition: graph.cpp:116
void inv_conjugate(matrix::Matrix_base< T > &M) const
Definition: permutations.cpp:207