#! /usr/bin/env python # def perm1_is_unicycle ( n, p ): #*****************************************************************************80 # ## PERM1_IS_UNICYCLE is TRUE if a 1-based permutation is a unicycle. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the number of objects in the permutation. # # Input, integer P(N), the permutation. # # Output, logical VALUE, is TRUE if the permutation is a unicycle. # from perm1 import perm1_check check = perm1_check ( n, p ) if ( not check ): value = False return value # # From 1, you must be able to take N-1 steps without reaching 1... # i = 1 for j in range ( 1, n + 1 ): i = p[i-1] if ( i == 1 ): if ( j < n ): value = False else: value = True return value value = False return value def perm1_is_unicycle_test ( ): #*****************************************************************************80 # ## PERM1_IS_UNICYCLE_TEST tests PERM1_IS_UNICYCLE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 25 August 2015 # # Author: # # John Burkardt # import platform from perm1 import perm1_print from perm1 import perm1_random n = 5 test_num = 10 seed = 123456789 print ( '' ) print ( 'PERM1_IS_UNICYCLE_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' PERM1_IS_UNICYCLE determines whether a 1-based permutation' ) print ( ' is a unicyle' ) for test in range ( 0, test_num ): p, seed = perm1_random ( n, seed ) value = perm1_is_unicycle ( n, p ) if ( value ): perm1_print ( n, p, ' This permutation is a unicycle' ) u = unicycle_index_to_sequence ( n, p ) unicycle_print ( n, u, ' The permutation in sequence form' ) else: perm1_print ( n, p, ' This permutation is NOT a unicycle' ) # # Terminate. # print ( '' ) print ( 'PERM1_IS_UNICYCLE_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_check ( n, p ): #*****************************************************************************80 # ## UNICYCLE_CHECK checks that a vector represents a unicycle. # # Discussion: # # A unicycle is a permutation with a single cycle. This might be called # a cyclic permutation, except that that name is used with at least two # other meanings. So, to be clear, a unicycle is a permutation of N # objects in which each object is returned to itself precisely after # N applications of the permutation. # # This routine verifies that each of the integers from 1 # to N occurs among the N entries of the permutation. # # Any permutation of the integers 1 to N describes a unicycle. # The permutation ( 3, 4, 2, 1 ) indicates that the unicycle # sends 3 to 4, 4 to 2, 2 to 1 and 1 to 3. This is the sequential # description of a unicycle. # # The standard sequence "rotates" the permutation so that it begins # with 1. The above sequence becomes a standard sequence when # written as ( 1, 3, 4, 2 ). # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the number of entries. # # Input, integer P(N), the unicycle sequence vector. # # Output, logical CHECK, is TRUE if the sequence represents a unicycle. # from sys import exit from perm1 import perm1_check check = perm1_check ( n, p ) if ( not check ): # print ( '' ) # print ( 'UNICYCLE_CHECK - Warning!' ) # print ( ' This is not a permutation!' ) return check check = perm1_is_unicycle ( n, p ) if ( not check ): # print ( '' ) # print ( 'UNICYCLE_CHECK - Warning!' ) # print ( ' Permutation is not a unicycle.' ) return check return check def unicycle_check_test ( ): #*****************************************************************************80 # ## UNICYCLE_CHECK_TEST tests UNICYCLE_CHECK. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import numpy as np import platform n = 5 p1 = np.array ( [ 5, 2, 3, 4, 1 ] ) p2 = np.array ( [ 4, 1, 3, 0, 2 ] ) p3 = np.array ( [ 4, 2, 1, 3, 2 ] ) p4 = np.array ( [ 2, 1, 4, 3, 5 ] ) p5 = np.array ( [ 3, 4, 5, 1, 2 ] ) print ( '' ) print ( 'UNICYCLE_CHECK_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_CHECK checks a unicycle.' ) unicycle_print ( n, p1, ' Candidate 1:' ) check = unicycle_check ( n, p1 ) if ( check ): print ( ' This is a unicycle!' ) else: print ( ' This is not a unicycle.' ) unicycle_print ( n, p2, ' Candidate 2:' ) check = unicycle_check ( n, p2 ) if ( check ): print ( ' This is a unicycle!' ) else: print ( ' This is not a unicycle.' ) unicycle_print ( n, p3, ' Candidate 3:' ) check = unicycle_check ( n, p3 ) if ( check ): print ( ' This is a unicycle!' ) else: print ( ' This is not a unicycle.' ) unicycle_print ( n, p4, ' Candidate 4:' ) check = unicycle_check ( n, p4 ) if ( check ): print ( ' This is a unicycle!' ) else: print ( ' This is not a unicycle.' ) unicycle_print ( n, p5, ' Candidate 5:' ) check = unicycle_check ( n, p5 ) if ( check ): print ( ' This is a unicycle!' ) else: print ( ' This is not a unicycle.' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_CHECK_TEST:' ) print ( ' Normal end of execution.' ) return def unicycle_enum ( n ): #*****************************************************************************80 # ## UNICYCLE_ENUM enumerates the unicycles. # # Discussion: # # Each standard sequence corresponds to a unique unicycle. Since the # first element of a standard sequence is always 1, the number of standard # sequences, and hence the number of unicycles, is (n-1)#. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 25 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicyle. # # Output, integer VALUE, the number of unicycles. # from i4_factorial import i4_factorial value = i4_factorial ( n - 1 ) return value def unicycle_enum_test ( ): #*****************************************************************************80 # ## UNICYCLE_ENUM_TEST tests UNICYCLE_ENUM. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 25 August 2015 # # Author: # # John Burkardt # import platform n_max = 10 print ( '' ) print ( 'UNICYCLE_ENUM_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_ENUM enumerates the unicycles of N objects.' ) print ( '' ) print ( ' N Number' ) print ( '' ) for n in range ( 0, n_max + 1 ): num = unicycle_enum ( n ) print ( ' %3d %8d' % ( n, num ) ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_ENUM_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_index ( n, u ): #*****************************************************************************80 # ## UNICYCLE_INDEX returns the index form of a unicycle. # # Example: # # N = 4 # # U = 1 3 4 2 # U_INDEX = 3 1 4 2 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2025 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicycles. # # Input, integer U(N), the unicycle sequence vector. # # Output, integer U_INDEX(N), the unicycle index vector. # import numpy as np from i4_wrap import i4_wrap u_index = np.zeros ( n, dtype = np.int32 ) for i in range ( 0, n ): ip1 = i4_wrap ( i + 1, 0, n - 1 ) u_index[u[i]-1] = u[ip1] return u_index def unicycle_index_test ( ): #*****************************************************************************80 # ## UNICYCLE_INDEX_TEST tests UNICYCLE_INDEX. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import platform n = 6 test_num = 5 seed = 123456789 print ( '' ) print ( 'UNICYCLE_INDEX_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_INDEX converts a unicycle to index form.' ) for test in range ( 0, 5 ): u, seed = unicycle_random ( n, seed ) unicycle_print ( n, u, ' The unicycle:' ) u_index = unicycle_index ( n, u ) unicycle_index_print ( n, u_index, ' The index form:' ) u2 = unicycle_index_to_sequence ( n, u_index ) unicycle_print ( n, u2, ' The unicycle recovered:' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_INDEX_TEST' ) print ( ' UNICYCLE_INDEX converts a unicycle to index form.' ) return def unicycle_index_print ( n, u_index, title ): #*****************************************************************************80 # ## UNICYCLE_INDEX_PRINT prints a unicycle given in index form. # # Example: # # Input: # # U_INDEX = 7 1 4 5 2 3 6 # # Printed output: # # 1 2 3 4 5 6 7 # 7 1 4 5 2 3 6 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicycle. # # Input, integer U_INDEX(N), the unicycle index vector. # # Input, string TITLE, a title. # inc = 20 if ( 0 < len ( title ) ): print ( '' ) print ( title ) for ilo in range ( 1, n, inc ): ihi = min ( n, ilo + inc - 1 ) print ( '' ) print ( ' ', end = '' ) for i in range ( ilo, ihi + 1 ): print ( '%4d' % ( i ), end = '' ) print ( '' ) print ( ' ', end = '' ) for i in range ( ilo, ihi + 1 ): print ( '%4d' % ( u_index[i-1] ), end = '' ) print ( '' ) return def unicycle_index_print_test ( ): #*****************************************************************************80 # ## UNICYCLE_INDEX_PRINT_TEST tests UNICYCLE_INDEX_PRINT; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import numpy as np import platform n = 7 print ( '' ) print ( 'UNICYCLE_INDEX_PRINT_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_INDEX_PRINT prints a unicyle given in index form;' ) print ( '' ) u_index = np.array ( [ 7, 1, 4, 5, 2, 3, 6 ] ) unicycle_index_print ( n, u_index, ' The unicycle in index form:' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_INDEX_PRINT_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_index_to_sequence ( n, u_index ): #*****************************************************************************80 # ## UNICYCLE_INDEX_TO_SEQUENCE converts a unicycle from index to sequence form. # # Example: # # N = 4 # # U_INDEX = 3 1 4 2 # U = 1 3 4 2 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicycles. # # Output, integer U_INDEX(N), the unicycle index vector. # # Input, integer U(N), the unicycle sequence vector. # import numpy as np from sys import exit u = np.zeros ( n, dtype = np.int32 ) u[0] = 1 i = 1 for j in range ( 1, n ): i = u_index[i-1] u[j] = i if ( i == 1 ): print ( '' ) print ( 'UNICYCLE_INDEX_TO_SEQUENCE - Fatal error!' ) print ( ' The index vector does not represent a unicycle.' ) print ( ' On step %d, u_index(%d) = 1.' % ( j, i ) ) exit ( 'UNICYCLE_INDEX_TO_SEQUENCE - Fatal error!' ) return u def unicycle_index_to_sequence_test ( ): #*****************************************************************************80 # ## UNICYCLE_INDEX_TO_SEQUENCE_TEST tests UNICYCLE_INDEX_TO_SEQUENCE. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import platform n = 6 seed = 123456789 print ( '' ) print ( 'UNICYCLE_INDEX_TO_SEQUENCE_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_INDEX_TO_SEQUENCE converts an index to unicycle form.' ) for test in range ( 0, 5 ): u, seed = unicycle_random ( n, seed ) unicycle_print ( n, u, ' The unicycle:' ) u_index = unicycle_index ( n, u ) unicycle_index_print ( n, u_index, ' The index form:' ) u2 = unicycle_index_to_sequence ( n, u_index ) unicycle_print ( n, u2, ' The unicycle recovered:' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_INDEX_TO_SEQUENCE_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_inverse ( n, u ): #*****************************************************************************80 # ## UNICYCLE_INVERSE returns the inverse of a unicycle. # # Example: # # N = 4 # # U = 1 3 4 2 # U_INVERSE = 1 2 4 3 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicycles. # # Input, integer U(N), the unicycle sequence vector. # # Output, integer U_INVERSE(N), the inverse unicycle. # import numpy as np u_inverse = np.zeros ( n, dtype = np.int32 ) u_inverse[0] = 1 for i in range ( 1, n ): u_inverse[i] = u[n-i] return u_inverse def unicycle_inverse_test ( ): #*****************************************************************************80 # ## UNICYCLE_INVERSE_TEST tests UNICYCLE_INVERSE; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import numpy as np import platform n = 7 u = np.array ( [ 1, 7, 6, 2, 4, 3, 5 ] ) print ( '' ) print ( 'UNICYCLE_INVERSE_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_INVERSE inverts a unicycle' ) unicycle_print ( n, u, ' The original unicycle:' ) u_inverse = unicycle_inverse ( n, u ) unicycle_print ( n, u_inverse, ' The inverse unicycle:' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_INVERSE_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_next ( n, u, rank ): #*****************************************************************************80 # ## UNICYCLE_NEXT generates unicycles in lexical order, one at a time. # # Example: # # N = 4 # # 1 1 2 3 4 # 2 1 2 4 3 # 3 1 3 2 4 # 4 1 3 4 2 # 5 1 4 2 3 # 6 1 4 3 2 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicycles. # # Input/output, integer U(N); on first call with MORE = FALSE, # this value is not used. Otherwise, the input value is the previous # unicycle. The output value is the next unicycle. # # Input/output, integer RANK, the rank. # If RANK = -1 on input, then the routine understands that this is # the first call, and that the user wishes the routine to supply # the first element in the ordering, which has RANK = 0. # In general, the input value of RANK is increased by 1 for output, # unless the very last element of the ordering was input, in which # case the output value of RANK is -1. # import numpy as np from perm1 import perm1_lex_next p = np.zeros ( n - 1, dtype = np.int32 ) if ( rank == -1 ): u[0] = 1 else: for i in range ( 0, n - 1 ): p[i] = u[i+1] - 1 p, rank = perm1_lex_next ( n - 1, p, rank ) for i in range ( 0, n - 1 ): u[i+1] = p[i] + 1 return u, rank def unicycle_next_test ( ): #*****************************************************************************80 # ## UNICYCLE_NEXT_TEST tests UNICYCLE_NEXT. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import numpy as np import platform n = 5 print ( '' ) print ( 'UNICYCLE_NEXT_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_NEXT generates unicycles in lex order.' ) print ( '' ) rank = -1 u = np.zeros ( n, dtype = np.int32 ) while ( True ): u, rank = unicycle_next ( n, u, rank ) if ( rank == - 1 ): break print ( ' %3d: ' % ( rank ), end = '' ) for i in range ( 0, n ): print ( '%2d' % ( u[i] ), end = '' ) print ( '' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_NEXT_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_print ( n, u, title ): #*****************************************************************************80 # ## UNICYCLE_PRINT prints a unicycle given in sequence form. # # Example: # # Input: # # U = 7 1 4 5 2 3 6 # # Printed output: # # 7 1 4 5 2 3 6 # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # # Parameters: # # Input, integer N, the order of the unicycle. # # Input, integer U(N), the unicycle sequence vector. # # Input, string TITLE, a title. # inc = 20 if ( 0 < len ( title ) ): print ( '' ) print ( title ) print ( '' ) for ilo in range ( 0, n, inc ): ihi = min ( n, ilo + inc ) for i in range ( ilo, ihi ): print ( ' %4d' % ( u[i] ), end = '' ) print ( '' ) return def unicycle_print_test ( ): #*****************************************************************************80 # ## UNICYCLE_PRINT_TEST tests UNICYCLE_PRINT; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import platform n = 5 print ( '' ) print ( 'UNICYCLE_PRINT_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_PRINT prints a unicyle;' ) seed = 123456789 u, seed = unicycle_random ( n, seed ) unicycle_print ( n, u, ' The unicycle:' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_PRINT_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_random ( n, seed ): #*****************************************************************************80 # ## UNICYCLE_RANDOM selects a random unicycle of N objects. # # Discussion: # # The routine assumes the objects are labeled 1, 2, ... N. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt. # # Reference: # # Albert Nijenhuis, Herbert Wilf, # Combinatorial Algorithms for Computers and Calculators, # Second Edition, # Academic Press, 1978, # ISBN: 0-12-519260-6, # LC: QA164.N54. # # Parameters: # # Input, integer N, the number of objects to be permuted. # # Input/output, integer SEED, a seed for the random number # generator. # # Output, integer U(N), a unicycle in sequence form. # from i4_uniform_ab import i4_uniform_ab from i4vec_indicator1 import i4vec_indicator1 u = i4vec_indicator1 ( n ) for i in range ( 1, n ): j, seed = i4_uniform_ab ( i, n - 1, seed ) t = u[i] u[i] = u[j] u[j] = t return u, seed def unicycle_random_test ( ): #*****************************************************************************80 # ## UNICYCLE_RANDOM_TEST tests UNICYCLE_RANDOM; # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import platform n = 5 print ( '' ) print ( 'UNICYCLE_RANDOM_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_RANDOM produces a random unicyle;' ) print ( ' For this test, N = %d' % ( n ) ) print ( '' ) seed = 123456789 for i in range ( 0, 5 ): u, seed = unicycle_random ( n, seed ) unicycle_print ( n, u, '' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_RANDOM_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_rank ( n, u ): #*****************************************************************************80 # ## UNICYCLE_RANK computes the rank of a unicycle. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt. # # Parameters: # # Input, integer N, the order of the unicycle. # # Input, integer U(N), a unicycle in sequence form. # # Output, integer RANK, the rank of the unicycle. # import numpy as np from perm1 import perm1_lex_rank p = np.zeros ( n - 1, dtype = np.int32 ) for i in range ( 0, n - 1 ): p[i] = u[i+1] - 1 rank = perm1_lex_rank ( n - 1, p ) return rank def unicycle_rank_test ( ): #*****************************************************************************80 # ## UNICYCLE_RANK_TEST tests UNICYCLE_RANK. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import numpy as np import platform n = 5 u = np.array ( [ 1, 5, 2, 3, 4 ] ) print ( '' ) print ( 'UNICYCLE_RANK_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_RANK ranks a unicycle.' ) unicycle_print ( n, u, ' The unicycle:' ) rank = unicycle_rank ( n, u ) print ( '' ) print ( ' The rank is: %d' % ( rank ) ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_RANK_TEST' ) print ( ' Normal end of execution.' ) return def unicycle_unrank ( n, rank ): #*****************************************************************************80 # ## UNICYCLE_UNRANK "unranks" a unicycle. # # Discussion: # # That is, given a rank, it computes the corresponding unicycle. # # The value of the rank should be between 0 and (N-1)#-1. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt. # # Reference: # # Dennis Stanton, Dennis White, # Constructive Combinatorics, # Springer, 1986, # ISBN: 0387963472, # LC: QA164.S79. # # Parameters: # # Input, integer N, the number of elements in the set. # # Input, integer RANK, the desired rank of the permutation. # # Output, integer U(N), the unicycle. # import numpy as np from perm1 import perm1_lex_unrank p = perm1_lex_unrank ( n - 1, rank ) u = np.zeros ( n, dtype = np.int32 ) u[0] = 1 for i in range ( 1, n ): u[i] = p[i-1] + 1 return u def unicycle_unrank_test ( ): #*****************************************************************************80 # ## UNICYCLE_UNRANK_TEST tests UNICYCLE_UNRANK. # # Licensing: # # This code is distributed under the GNU LGPL license. # # Modified: # # 26 August 2015 # # Author: # # John Burkardt # import platform n = 5 print ( '' ) print ( 'UNICYCLE_UNRANK_TEST' ) print ( ' Python version: %s' % ( platform.python_version ( ) ) ) print ( ' UNICYCLE_UNRANK, given a rank, computes the' ) print ( ' corresponding unicycle.' ) print ( '' ) rank = 6 print ( ' The requested rank is %d' % ( rank ) ) u = unicycle_unrank ( n, rank ) unicycle_print ( n, u, ' The unicycle:' ) # # Terminate. # print ( '' ) print ( 'UNICYCLE_UNRANK_TEST' ) print ( ' Normal end of execution.' ) return if ( __name__ == '__main__' ): from timestamp import timestamp timestamp ( ) perm1_is_unicycle_test ( ) unicycle_check_test ( ) unicycle_enum_test ( ) unicycle_index_test ( ) unicycle_index_print_test ( ) unicycle_index_to_sequence_test ( ) unicycle_inverse_test ( ) unicycle_next_test ( ) unicycle_print_test ( ) unicycle_random_test ( ) unicycle_rank_test ( ) unicycle_unrank_test ( ) timestamp ( )