Atelier des rouesLab FR
Objects/Documentation

rotations.py

I compare rank histograms with label-rotation orbits.

Download ↓
"""Exhaust finite label-rotation orbits and conditional rank histograms (NumPy)."""
import argparse
from collections import defaultdict
import json
from math import factorial, gcd
from pathlib import Path

import numpy as np


def all_by_rank(k):
    """Apply the circular unranking rotations to all ranks at once."""
    ranks = np.arange(factorial(k), dtype=np.int64)
    words = np.tile(np.arange(k, dtype=np.int16), (len(ranks), 1))
    for size in range(k, 1, -1):
        digit = (ranks // factorial(size-1)) % size

Read in context

Comments

Comments from both language editions appear here.

The discussion is open for reading. I’ll enable submissions once spam protection is configured.