|
tgen
|
Permutation instance. More...

Public Member Functions | |
| instance (const std::vector< int > &vec) | |
| Creates a permutation instance from a std::vector. | |
| int | size () const |
| Returns the size of the permutation instance. | |
| const int & | operator[] (int idx) const |
| Returns the value at some position of the instance. | |
| int | parity () const |
| Parity of the permutation. | |
| instance & | sort () |
| Sorts the instance in non-decreasing order. | |
| instance & | reverse () |
| Reverses the instance. | |
| instance & | inverse () |
| Inverse of the permutation. | |
| instance & | separator (char sep) |
| Sets separator for printing. | |
| instance & | add_1 () |
| Adds 1 for printing. | |
| std::vector< int > | to_std () const |
| Converts the instance to a std::vector. | |
| Public Member Functions inherited from tgen::gen_instance_base< instance > | |
| bool | operator< (const instance &rhs) const |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const instance &inst) |
| Prints the instance to a std::ostream. | |
Permutation instance.
Instance of a permutation.
It can be deterministically operated upon (see Generator Instance Operations for random operations) and printed through std::cout.
|
inline |
Creates a permutation instance from a std::vector.
| vec | The std::vector representing the instance. |
|
inline |
Adds 1 for printing.
This makes it so, when given to std::cout, the permutation will be printed as 1-based.
O(1).
|
inline |
Inverse of the permutation.
The inverse of the permutation p is another pi such that pi[p[i]] = p[pi[i]] = i.
O(n).
|
inline |
Returns the value at some position of the instance.
| idx | Index to be accessed. |
|
inline |
Parity of the permutation.
|
inline |
Reverses the instance.
O(n).
|
inline |
Sets separator for printing.
O(1).
|
inline |
Returns the size of the permutation instance.
|
inline |
Sorts the instance in non-decreasing order.
O(n).
|
inline |
Converts the instance to a std::vector.
|
friend |
Prints the instance to a std::ostream.
The values are printed with one space as a separator, and with no end of line.