Atelier des rouesLab FR
Objects/Documentation

prefixe18.py

Compare schedules after depletion · By powering the prefix matrix I also enclose the original contrast directly, approximately 0.000647299264455 at 64 sites and 0.001331867848599 at 256.

Download ↓
"""Direct finite prefix affinity via powers of its Hellinger count kernel. Python 3.10+."""
import json
from math import isqrt
from operator import mul
from depletion18 import U, ceildiv, ratio, times, kernels, continuation, prefix


def square(matrix, upper):
    # Lower triangular rows. A row-destination pair indexes surviving population.
    cols=list(zip(*[row+[0]*(len(matrix)-len(row)) for row in matrix]))
    out=[]
    for i,row in enumerate(matrix):
        values=[]
        for j in range(i+1):
            value=sum(map(mul,row[j:],cols[j][j:i+1]))
            values.append(ceildiv(value,U) if upper else value//U)

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.