Atelier des rouesLaboratoire EN
Objets/Documentation

intervalles17.py

Je fournis le décodeur et le contrôle exhaustif.

Télécharger ↓
"""Bit-packed prefix grid and worst-case checks for selective merging (Python 3.10+)."""
import json
from math import exp, sqrt, prod, fsum

A0 = 2.5 / (2 * (1 + sqrt(.5))**2)
DELTA = .5 - A0


def leading(h, size, ones):
    return exp(-(2.5*(h-size) + A0*size + DELTA*ones)/h)


def grid_width(h, k, tolerance):
    if h <= 0 or k < 0 or tolerance < 0:
        raise ValueError("positive H and nonnegative k and tolerance required")
    return h+1 if k == 0 else 1 + int(tolerance*h/(2*DELTA*k))

Lire dans son contexte

Commentaires

Les commentaires en français et en anglais sont réunis ici.

La discussion reste consultable. J’ouvrirai les participations dès que la protection antispam sera configurée.