permlib  0.2.8
Library for permutation computations
 All Classes Functions Variables Typedefs Enumerations Friends
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
permlib::Permutation Class Reference

Permutation class storing all values explicitly. More...

#include <permutation.h>

Public Types

typedef std::vector< dom_int > perm
 typedef for permutation image
 
typedef boost::shared_ptr
< Permutation
ptr
 boost shared_ptr of this class
 

Public Member Functions

 Permutation (dom_int n)
 constructs identity permutation acting on n elements
 
 Permutation (dom_int n, const std::string &cycles)
 constructs permutation acting on n elements, given by string in cycle form
 
 Permutation (dom_int n, const char *cycles)
 constructs permutation acting on n elements, given by string in cycle form
 
 Permutation (const perm &p)
 sort of copy constructor
 
 Permutation (const Permutation &p)
 copy constructor
 
template<class InputIterator >
 Permutation (InputIterator begin, InputIterator end)
 construct from dom_int-iterator
 
Permutation operator* (const Permutation &p) const
 permutation multiplication from the right
 
Permutationoperator*= (const Permutation &p)
 permutation inplace multiplication from the right
 
Permutationoperator^= (const Permutation &p)
 permutation inplace multiplication from the left
 
Permutation operator~ () const
 permutation inversion
 
PermutationinvertInplace ()
 permutation inplace inversion
 
bool operator== (const Permutation &p2) const
 equals operator
 
dom_int operator/ (dom_int val) const
 lets permutation act on val
 
dom_int at (dom_int val) const
 lets permutation act on val
 
dom_int operator% (dom_int val) const
 lets inverse permutation act on val, i.e. compute j such that (this->at(j) == val)
 
bool isIdentity () const
 returns true if this permutation is identity
 
void flush ()
 dummy stub for interface compatability with PermutationWord
 
dom_int size () const
 number of points this permutation acts on
 
std::list< std::pair< dom_int,
unsigned int > > 
cycles (bool includeTrivialCycles=false) const
 computes all cycles of this permutation
 
boost::uint64_t order () const
 computes the order of this permutation
 
template<typename ForwardIterator >
Permutationproject (unsigned int n_proj, ForwardIterator begin, ForwardIterator end) const
 restricts this permutation p to a subset S of the domain
 
void setTransposition (dom_int pos, dom_int val)
 updates this permutation such that pos is mapped onto val and val onto pos
 

Protected Member Functions

 Permutation (dom_int n, bool)
 INTERNAL ONLY: constructs an "empty" permutation, i.e. without element mapping.
 
void initFromCycleString (const std::string &cycles)
 initializes permutation data from a string in cycle form
 

Protected Attributes

perm m_perm
 defintion of permutation behavior
 
bool m_isIdentity
 if set to true, permutation is identity; if set to false then it is not known whether this is identity;
 

Friends

struct permlib::exports::BSGSSchreierExport
 
std::ostream & operator<< (std::ostream &out, const Permutation &p)
 output in cycle form
 

Detailed Description

Permutation class storing all values explicitly.

Member Function Documentation

std::list< std::pair< dom_int, unsigned int > > permlib::Permutation::cycles ( bool  includeTrivialCycles = false) const
inline

computes all cycles of this permutation

Parameters
includeTrivialCyclesif true, the result list contains also cycles consisting of one single element
Returns
list of pairs [minimal element of cycle, cycle length]
bool permlib::Permutation::isIdentity ( ) const
inline

returns true if this permutation is identity

This is done by checking the image of every point.

Permutation & permlib::Permutation::operator*= ( const Permutation p)
inline

permutation inplace multiplication from the right

i.e. THIS := THIS * p

Permutation & permlib::Permutation::operator^= ( const Permutation p)
inline

permutation inplace multiplication from the left

i.e. THIS := p * THIS

boost::uint64_t permlib::Permutation::order ( ) const
inline

computes the order of this permutation

Returns
number c such that p^c = identity
template<typename ForwardIterator >
Permutation * permlib::Permutation::project ( unsigned int  n_proj,
ForwardIterator  begin,
ForwardIterator  end 
) const

restricts this permutation p to a subset S of the domain

S must fullfill S^p = S

Parameters
n_projdegree of the restricted permutation (ie. number of elements in the subset S
beginbegin-iterator to subset S
endend-iterator to subset S
Returns
pointer to a permutation which is restricted to the given domain subset

The documentation for this class was generated from the following file: