Permutations with a Single Cycle

**UNICYCLE**
is a Python library which
carries out some operations on permutations with a single cycle.

A permutation with a single cycle is a permutation P of N objects with the property that, for every object, it takes exactly N applications of P to restore an object to its original value.

Another way to think of this is that a permutation with a single cycle can be symbolized by a bracelet with N beads; the action of the permutation is to rotate the bracelet one position.

A permutation with a single cycle can be written in "sequence" form. Assuming the objects are labeled 1 through N, we start with 1, followed by P(1), followed by P(P(1)), and so on. Thus, the sequence (1,4,2,5,3) indicates the permutation which maps 1->4, 2->5, 3->1, 4->2, and 5->3.

A permutation with a single cycle is sometimes called a "cyclic permutation", but this term is also used with other meanings. Hence, we will affectionately call these objects "unicycles".

The computer code and data files described and made available on this web page are distributed under the GNU LGPL license.

**UNICYCLE** is available in
a C version and
a C++ version and
a FORTRAN90 version and
a MATLAB version and
a Python version.

SUBSET, a Python library which generates, ranks and unranks various combinatorial objects.

- i4_factorial.py, computes the factorial of N.
- i4_modp.py, returns the nonnegative remainder of I4 division.
- i4_uniform_ab.py, returns a scaled pseudorandom I4.
- i4_wrap.py, forces an I4 to lie between given limits by wrapping.
- i4vec_indicator1.py, sets an I4VEC to the 1-based indicator vector.
- i4vec_print.py, prints an I4VEC.
- i4vec_reverse.py, reverses the elements of an I4VEC.
- i4vec_uniform_ab.py, sets an I4VEC with scaled pseudorandom values.
- perm1.py, functions for 1-based permutations.
- timestamp.py, prints the current YMDHMS date as a time stamp.
- unicycle.py, functions for 1-based unicycles.

- unicycle_test.py, calls all the tests.
- unicycle_test.sh, runs all the tests.
- unicycle_test.txt, the output file.

You can go up one level to the Python source codes.