permutation Class Reference

#include <permutation.h>


Detailed Description

A permutation.

Definition at line 51 of file permutation.h.


Public Member Functions

 permutation (size_t dim=0)
size_t get (size_t i) const
 Get (with optional range-checking).
int set (size_t i, size_t val)
 Set (with optional range-checking).
int init ()
 Initialize permutation to the identity.
size_t size () const
 Return permutation size.
int allocate (size_t dim)
 Allocate memory for a permutation of size dim.
int free ()
 Free the memory.
int swap (const size_t i, const size_t j)
 Swap two elements of a permutation.
bool valid ()
 Check to see that a permutation is valid.
int reverse ()
 Reverse the permutation.
permutation inverse ()
 Compute the inverse of a permutation.
template<class vec_t>
int apply (vec_t &v)
 Apply the permutation to a vector.
template<class vec_t>
int apply_inverse (vec_t &v)
 Apply the permutation to a vector.
Copy constructors
 permutation (const permutation &v)
permutationoperator= (const permutation &v)

Member Function Documentation

size_t size (  )  const [inline]

Return permutation size.

If no memory has been allocated, this will quietly return zero.

Definition at line 131 of file permutation.h.

int free (  )  [inline]

Free the memory.

This function will safely do nothing if used without first allocating memory or if called multiple times in succession.

Definition at line 153 of file permutation.h.

int apply ( vec_t &  v  )  [inline]

Apply the permutation to a vector.

Now have k==i, i.e. the least in its cycle

Definition at line 204 of file permutation.h.

int apply_inverse ( vec_t &  v  )  [inline]

Apply the permutation to a vector.

Now have k==i, i.e. the least in its cycle

Definition at line 229 of file permutation.h.


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

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page