Class permutation (o2scl)¶
-
class permutation¶
A class for representing permutations.
To apply a permutation to a user-specified vector, see o2scl::permutation::apply().
Copy constructors
-
inline permutation(const permutation &v)¶
-
inline permutation &operator=(const permutation &v)¶
-
inline ~permutation()¶
-
inline size_t &operator[](size_t i)¶
Array-like indexing.
-
inline const size_t &operator[](size_t i) const¶
Array-like indexing.
-
inline size_t &operator()(size_t i)¶
Array-like indexing.
-
inline const size_t &operator()(size_t i) const¶
Array-like indexing.
-
inline size_t get(size_t i) const¶
Get (with optional range-checking)
-
inline int set(size_t i, size_t val)¶
Set (with optional range-checking)
-
inline int init()¶
Initialize permutation to the identity.
-
inline size_t size() const¶
Return permutation size.
If no memory has been allocated, this will quietly return zero.
-
inline int allocate(size_t dim)¶
Allocate memory for a permutation of size
dim
.
-
inline int free()¶
Free the memory.
This function will safely do nothing if used without first allocating memory or if called multiple times in succession.
-
inline void resize(size_t dim)¶
Resize.
-
inline int swap(const size_t i, const size_t j)¶
Swap two elements of a permutation.
-
inline bool valid() const¶
Check to see that a permutation is valid.
-
inline int reverse()¶
Reverse the permutation.
-
inline permutation inverse() const¶
Compute the inverse of a permutation.
Public Functions
-
inline permutation(size_t dim = 0)¶
Create a permutation of size
dim
.
-
inline permutation(const permutation &v)¶