|
gslmm::permutation Class Reference
[Permutations .]
#include <gslmm/permutation/permutation.hh>
Collaboration diagram for gslmm::permutation:
[legend]List of all members.
Detailed Description
Permutation representation.
A permutation is represented by an array of integers in the range , where each value occurs once and only once.
Note that this is not a template, as it only makes sense for integer values.
- Todo:
- Should I leave in the put-to operator?
- Examples:
-
linear/linear-test.cc, and permutation/permutation-test.cc.
|
Public Member Functions |
| permutation (size_t n, bool id=true) |
| permutation (const permutation &o) |
virtual | ~permutation () |
size_t | size () const |
bool | is_valid () const |
bool | is_canonical () const |
size_t & | operator[] (const size_t i) |
const size_t & | operator[] (const size_t i) const |
void | swap (const size_t i, const size_t j) |
void | identity () |
void | reverse () |
permutation | inverse () |
bool | next () |
bool | previous () |
size_t | inversions () const |
size_t | cycles () const |
permutation | canonical () |
permutation | linear () |
template<typename Type> |
void | permute (Type data, size_t n, size_t stride=1, bool inv=false) const |
template<typename Type> |
void | permute (vector< Type > &v, bool inv=false) const |
template<typename Type> |
void | permute (complex< Type > &c, bool inv=false) const |
permutation & | operator= (const permutation &o) |
permutation & | operator *= (const permutation &o) |
template<> |
void | permute (double *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (long double *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (float *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (long *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (unsigned long *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (int *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (unsigned int *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (short *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (unsigned short *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (char *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (unsigned char *data, size_t n, size_t stride, bool inv) const |
template<> |
void | permute (gslmm::vector< double > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< long double > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< float > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< long > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< unsigned long > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< int > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< unsigned int > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< short > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< unsigned short > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< char > &v, bool inv) const |
template<> |
void | permute (gslmm::vector< unsigned char > &v, bool inv) const |
Public Attributes |
gsl_permutation * | _permutation |
Protected Attributes |
bool | _canonical |
Friends |
permutation | operator * (const permutation &lhs, const permutation &rhs) |
Constructor & Destructor Documentation
gslmm::permutation::permutation |
( |
size_t |
n, |
|
|
bool |
id = true |
|
) |
[inline] |
|
|
Constructor.
- Parameters:
-
| n | The size of the permutation |
| id | if true, initialise this to identity, otherwise, it's not initialised at all. |
|
gslmm::permutation::permutation |
( |
const permutation & |
o |
) |
[inline] |
|
gslmm::permutation::~permutation |
( |
|
) |
[inline, virtual] |
|
Member Function Documentation
|
Return canonical form of this permutation.
If the permutation is already on canonical form, this is just a copy. |
size_t gslmm::permutation::cycles |
( |
|
) |
const [inline] |
|
|
Count the number of cycles.
|
void gslmm::permutation::identity |
( |
|
) |
[inline] |
|
|
Make this permutation the identity permutation.
|
|
Get the inverse permutation of this.
|
size_t gslmm::permutation::inversions |
( |
|
) |
const [inline] |
|
|
Count number of inversions.
|
bool gslmm::permutation::is_canonical |
( |
|
) |
const [inline] |
|
|
Check if this is in canonical form or not.
|
bool gslmm::permutation::is_valid |
( |
|
) |
const [inline] |
|
|
Check if this is a valid permutation.
|
|
Return linear form of this permutation.
If the permutation is already on linear form, this is just a copy. |
bool gslmm::permutation::next |
( |
|
) |
[inline] |
|
|
Advances this permutation to the next permutation in lexicographic order.
Starting with the identity permutation and repeatedly applying this operation will iterate through all possible permutations of a given order. - Returns:
- true if the permutation was advanced. If no further permutations are available, returns false and leaves the permutation unmodified.
- Examples:
-
permutation/permutation-test.cc.
|
const size_t & gslmm::permutation::operator[] |
( |
const size_t |
i |
) |
const [inline] |
|
|
Access an element in the permutation.
|
size_t & gslmm::permutation::operator[] |
( |
const size_t |
i |
) |
[inline] |
|
|
Access an element in the permutation.
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< unsigned char > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< char > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< unsigned short > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< short > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< unsigned int > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< int > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< unsigned long > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< long > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< float > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< long double > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
gslmm::vector< double > & |
v, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
unsigned char * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
char * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
unsigned short * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
short * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
unsigned int * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
int * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
unsigned long * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
long * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
float * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
long double * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<> |
void gslmm::permutation::permute |
( |
double * |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride, |
|
|
bool |
inv |
|
) |
const [inline] |
|
template<typename Type> |
void gslmm::permutation::permute |
( |
complex< Type > & |
c, |
|
|
bool |
inv = false |
|
) |
const [inline] |
|
|
Permute the complex number c.
|
template<typename Type> |
void gslmm::permutation::permute |
( |
vector< Type > & |
v, |
|
|
bool |
inv = false |
|
) |
const [inline] |
|
template<typename Type> |
void gslmm::permutation::permute |
( |
Type |
data, |
|
|
size_t |
n, |
|
|
size_t |
stride = 1 , |
|
|
bool |
inv = false |
|
) |
const [inline] |
|
bool gslmm::permutation::previous |
( |
|
) |
[inline] |
|
void gslmm::permutation::reverse |
( |
|
) |
[inline] |
|
|
Turn this permutation into it's reverse.
|
size_t gslmm::permutation::size |
( |
|
) |
const [inline] |
|
|
Get the size of this permutation.
|
void gslmm::permutation::swap |
( |
const size_t |
i, |
|
|
const size_t |
j |
|
) |
[inline] |
|
Friends And Related Function Documentation
Member Data Documentation
|
Wether this is in canonical form or not.
|
The documentation for this class was generated from the following file:
|