Atelier des rouesLab FR
Objects/Documentation

verifier29.py

Shared conditionals and checks · verifier29.py

Download ↓
"""Verify algebraic-radius certificates with the Python standard library only."""
from fractions import Fraction as F
from itertools import product
from math import gcd,lcm
from pathlib import Path
from verifier26 import verify
import json,sys
def rows_at(laws,probe,t):
    corners=((0,0),(1,0),(0,1),(1,1))
    for r in laws:
        lower=[([-1]*4,[0]*4)];upper=[([1]*4,[1]*4)]
        for i,j,k,l in product((0,1),repeat=4):
            def cf(x,y):return j+(i-j)*x-l-(k-l)*y
            def rhs(x,y):return sum(a*b for a,b in zip((i,j,k,l),r))+t-l-(k-l)*y
            sign=cf(*probe);c=[cf(*p) for p in corners];y=[rhs(*p) for p in corners]
            if sign<0:lower.append((c,y))

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.