omnibias.core.verified.line
Coefficient recurrences, activation contracts, jet algebra, and verified arithmetic shared by the numerical backends.
import omnibias.core.verified.lineModule contract & mathematical conventions
Verified *line* (non-periodic) Hilbert transform on the Poisson basis.
The periodic Hilbert transform (omnibias.core.verified.spectral) lives on a
box; a self-similar blow-up profile lives on the whole line with **algebraic**
far-field decay. This module supplies the line operator rigorously by working in
the basis where the line Hilbert transform acts *exactly* -- the Poisson /
conjugate-Poisson pair. For a scale a > 0 define
p_a(x) = a / (x^2 + a^2) (even, the Poisson kernel), q_a(x) = x / (x^2 + a^2) (odd, the conjugate Poisson kernel).
These are the alpha = 1 special case of the generalized Cauchy-Hardy pair in
omnibias.core.verified.hardy_line (P_{a,1} = p_a, Q_{a,1} = q_a).
For self-similar far fields with exponent alpha = 1/(1+lambda) != 1, use
the Hardy module instead.
With the convention H[f](x) = (1/pi) p.v. \int f(t)/(x - t) dt the Hilbert
transform rotates the pair (a fact equivalent to hat{p_a}(xi) = pi e^{-a|xi|}
and the multiplier -i sgn(xi)):
H[p_a] = q_a, H[q_a] = -p_a.
So an odd profile Omega = sum_i c_i q_{a_i} has the **exact** closed forms
Omega' = sum_i c_i q_{a_i}', U' = H[Omega] = - sum_i c_i p_{a_i}, U = \int_0^x U' = - sum_i c_i atan(x / a_i),
with no quadrature and no truncated tail -- the nonlocal operator is exact, and the
|x|^{-1} decay of q_a is the physical self-similar far field. Every value is
returned as an outward-rounded Interval; the only transcendental is the
rigorous atan enclosure (the velocity primitive).
The rotation identities are *proved* (Fourier multiplier) and *checked* in the tests against an independent high-precision principal-value quadrature.
Shared formulas do not imply universal floating-point identity. Verify dtype, shape, derivative-order support, and the stated numerical assumptions for the path you use.
conjugate_poisson
omnibias.core.verified.conjugate_poissonSource ↗conjugate_poisson(x: float, a: float) -> IntervalVerified q_a(x) = x / (x^2 + a^2) (odd); decays like 1/x.
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · conjugate decays like inverse x
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_conjugate_decays_like_inverse_x() -> None:
"""Physical far field: |q_a(x)| ~ 1/x (not exponentially small)."""
a = 1.0
big = conjugate_poisson(1000.0, a)
assert 0.0 < big.lo
assert big.contains(1000.0 / (1000.0**2 + 1.0))python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_conjugate_decays_like_inverse_x" -qRegression example · basis encloses truth
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_basis_encloses_truth(x: float, a: float) -> None:
d = x * x + a * a
assert poisson_kernel(x, a).contains(a / d)
assert conjugate_poisson(x, a).contains(x / d)
assert conjugate_poisson_deriv(x, a).contains((a * a - x * x) / (d * d))
assert poisson_kernel_deriv(x, a).contains(-2.0 * a * x / (d * d))
assert poisson_primitive(x, a).contains(math.atan(x / a))python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_basis_encloses_truth -qRead the implementation
def conjugate_poisson(x: float, a: float) -> Interval:
"""Verified ``q_a(x) = x / (x^2 + a^2)`` (odd); decays like ``1/x``."""
return Interval.point(x) * _denom(x, a).reciprocal()Other public import paths
omnibias.core.verified.conjugate_poissonomnibias.core.verified.line.conjugate_poisson
conjugate_poisson_deriv
omnibias.core.verified.conjugate_poisson_derivSource ↗conjugate_poisson_deriv(x: float, a: float) -> IntervalVerified q_a'(x) = (a^2 - x^2) / (x^2 + a^2)^2 (even).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · basis encloses truth
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_basis_encloses_truth(x: float, a: float) -> None:
d = x * x + a * a
assert poisson_kernel(x, a).contains(a / d)
assert conjugate_poisson(x, a).contains(x / d)
assert conjugate_poisson_deriv(x, a).contains((a * a - x * x) / (d * d))
assert poisson_kernel_deriv(x, a).contains(-2.0 * a * x / (d * d))
assert poisson_primitive(x, a).contains(math.atan(x / a))python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_basis_encloses_truth[-0.4-0.5]" -qRegression example · alpha one recovers poisson
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_alpha_one_recovers_poisson() -> None:
for a in (0.5, 1.3, 2.0):
for y in (-2.0, 0.0, 0.7, 5.0):
assert hardy_even(y, a, 1.0).contains(float(poisson_kernel(y, a).mid))
assert hardy_odd(y, a, 1.0).contains(float(conjugate_poisson(y, a).mid))
# Derivatives match Poisson closed forms at alpha=1.
assert hardy_even_deriv(y, a, 1.0).contains(
float(poisson_kernel_deriv(y, a).mid)
)
assert hardy_odd_deriv(y, a, 1.0).contains(
float(conjugate_poisson_deriv(y, a).mid)
)python -m pytest packages/omnibias-core/tests/verified/test_hardy_line.py -k test_alpha_one_recovers_poisson -qRead the implementation
def conjugate_poisson_deriv(x: float, a: float) -> Interval:
"""Verified ``q_a'(x) = (a^2 - x^2) / (x^2 + a^2)^2`` (even)."""
num = Interval.point(a).pow_int(2) - Interval.point(x).pow_int(2)
return num * _denom(x, a).pow_int(2).reciprocal()Other public import paths
omnibias.core.verified.conjugate_poisson_derivomnibias.core.verified.line.conjugate_poisson_deriv
conjugate_poisson_deriv_matrix
omnibias.core.verified.conjugate_poisson_deriv_matrixSource ↗conjugate_poisson_deriv_matrix(x_nodes: Sequence[float], a_values: Sequence[float]) -> list[list[Interval]][[q_{a_i}'(x_j)]] -- the profile-derivative design matrix.
Parameters
| Name | Type & default | Contract |
|---|---|---|
x_nodespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
a_valuespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
list[list[Interval]]Read the implementation
def conjugate_poisson_deriv_matrix(x_nodes: Sequence[float],
a_values: Sequence[float]) -> list[list[Interval]]:
"""``[[q_{a_i}'(x_j)]]`` -- the profile-derivative design matrix."""
return _matrix(conjugate_poisson_deriv, x_nodes, a_values)Other public import paths
omnibias.core.verified.conjugate_poisson_deriv_matrixomnibias.core.verified.line.conjugate_poisson_deriv_matrix
conjugate_poisson_matrix
omnibias.core.verified.conjugate_poisson_matrixSource ↗conjugate_poisson_matrix(x_nodes: Sequence[float], a_values: Sequence[float]) -> list[list[Interval]][[q_{a_i}(x_j)]] -- the odd profile design matrix.
Parameters
| Name | Type & default | Contract |
|---|---|---|
x_nodespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
a_valuespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
list[list[Interval]]Read the implementation
def conjugate_poisson_matrix(x_nodes: Sequence[float],
a_values: Sequence[float]) -> list[list[Interval]]:
"""``[[q_{a_i}(x_j)]]`` -- the odd profile design matrix."""
return _matrix(conjugate_poisson, x_nodes, a_values)Other public import paths
omnibias.core.verified.conjugate_poisson_matrixomnibias.core.verified.line.conjugate_poisson_matrix
even_profile
omnibias.core.verified.even_profileSource ↗even_profile(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> IntervalVerified even profile Theta(x) = sum_i c_i p_{a_i}(x).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
coeffspositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
scalespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
IntervalExecuted regression · even profile rejects bad input
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_rejects_bad_input() -> None:
with pytest.raises(ValueError):
even_profile(0.5, (1.0, 2.0), (1.0,)) # mismatched lengths
with pytest.raises(ValueError):
even_profile(0.5, (1.0,), (0.0,)) # zero scale
with pytest.raises(ValueError):
even_profile(0.5, (), ()) # emptypython -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_even_profile_rejects_bad_input" -qRegression example · even profile is even and deriv is odd
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_is_even_and_deriv_is_odd() -> None:
for x in (0.3, 1.7, 4.2):
assert even_profile(x, _COEFFS, _SCALES).contains(even_profile(-x, _COEFFS, _SCALES).mid)
d_pos = even_profile_deriv(x, _COEFFS, _SCALES)
d_neg = even_profile_deriv(-x, _COEFFS, _SCALES)
assert d_pos.contains(-d_neg.mid)python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_even_profile_is_even_and_deriv_is_odd -qRead the implementation
def even_profile(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> Interval:
r"""Verified even profile ``Theta(x) = sum_i c_i p_{a_i}(x)``."""
return _profile_sum(poisson_kernel, x, coeffs, scales)Other public import paths
omnibias.core.verified.even_profileomnibias.core.verified.line.even_profile
even_profile_deriv
omnibias.core.verified.even_profile_derivSource ↗even_profile_deriv(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> IntervalVerified Theta'(x) = sum_i c_i p_{a_i}'(x) (odd).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
coeffspositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
scalespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
IntervalExecuted regression · even profile is even and deriv is odd
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_is_even_and_deriv_is_odd() -> None:
for x in (0.3, 1.7, 4.2):
assert even_profile(x, _COEFFS, _SCALES).contains(even_profile(-x, _COEFFS, _SCALES).mid)
d_pos = even_profile_deriv(x, _COEFFS, _SCALES)
d_neg = even_profile_deriv(-x, _COEFFS, _SCALES)
assert d_pos.contains(-d_neg.mid)python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_even_profile_is_even_and_deriv_is_odd" -qRegression example · even profile values enclose truth
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_values_enclose_truth(x: float) -> None:
theta_true = sum(c * (a / (x * x + a * a)) for c, a in zip(_COEFFS, _SCALES, strict=True))
dtheta_true = sum(c * (-2.0 * a * x / (x * x + a * a) ** 2) for c, a in zip(_COEFFS, _SCALES, strict=True))
assert even_profile(x, _COEFFS, _SCALES).contains(theta_true)
assert even_profile_deriv(x, _COEFFS, _SCALES).contains(dtheta_true)python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_even_profile_values_enclose_truth -qRead the implementation
def even_profile_deriv(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> Interval:
r"""Verified ``Theta'(x) = sum_i c_i p_{a_i}'(x)`` (odd)."""
return _profile_sum(poisson_kernel_deriv, x, coeffs, scales)Other public import paths
omnibias.core.verified.even_profile_derivomnibias.core.verified.line.even_profile_deriv
even_profile_tail_constant
omnibias.core.verified.even_profile_tail_constantSource ↗even_profile_tail_constant(coeffs: Sequence[float], scales: Sequence[float]) -> tuple[float, float]Rigorous far-field decay (C, p) with |Theta(x)| <= C |x|^{-p}.
Since p_a(x) = a/(x^2+a^2) <= |a|/x^2, the even profile obeys
|Theta(x)| <= (sum_i |c_i| |a_i|) |x|^{-2}; returns that outward-rounded
constant and p = 2 for feeding hilbert_tail_bound.
Parameters
| Name | Type & default | Contract |
|---|---|---|
coeffspositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
scalespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
tuple[float, float]Explicit validation & failure cases
- When
len(coeffs) != len(scales), raisesValueError('coeffs and scales must have the same length').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · even profile tail constant bounds far field
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_tail_constant_bounds_far_field() -> None:
c_const, p = even_profile_tail_constant(_COEFFS, _SCALES)
assert p == 2.0
# |Theta(x)| <= C |x|^{-2} must hold in the far field.
for x in (10.0, 50.0, 200.0):
theta = abs(even_profile(x, _COEFFS, _SCALES).mid)
assert theta <= c_const / x**2 + 1e-15
# feeds the Hilbert tail bound without error
b = hilbert_tail_bound(decay_const=c_const, decay_power=p, x_trunc=20.0, core_radius=3.0)
assert b.hi > 0.0python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_even_profile_tail_constant_bounds_far_field" -qRead the implementation
def even_profile_tail_constant(
coeffs: Sequence[float], scales: Sequence[float]
) -> tuple[float, float]:
r"""Rigorous far-field decay ``(C, p)`` with ``|Theta(x)| <= C |x|^{-p}``.
Since ``p_a(x) = a/(x^2+a^2) <= |a|/x^2``, the even profile obeys
``|Theta(x)| <= (sum_i |c_i| |a_i|) |x|^{-2}``; returns that outward-rounded
constant and ``p = 2`` for feeding :func:`hilbert_tail_bound`.
"""
if len(coeffs) != len(scales):
raise ValueError("coeffs and scales must have the same length")
acc = Interval.point(0.0)
for c, a in zip(coeffs, scales, strict=True):
acc = acc + Interval.point(float(c)).abs() * Interval.point(float(a)).abs()
return acc.hi, 2.0Other public import paths
omnibias.core.verified.even_profile_tail_constantomnibias.core.verified.line.even_profile_tail_constant
hilbert_even_profile
omnibias.core.verified.hilbert_even_profileSource ↗hilbert_even_profile(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> IntervalVerified **exact** H[Theta](x) = sum_i c_i q_{a_i}(x) (odd).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
coeffspositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
scalespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
IntervalExecuted regression · hilbert even profile matches pv quadrature
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hilbert_even_profile_matches_pv_quadrature(x0: float) -> None:
# H[Theta] computed exactly term-by-term must match the desingularized PV integral.
with mp.workdps(40):
fx0 = _mp_theta(mp.mpf(x0))
def integrand(t: object) -> object:
return (_mp_theta(t) - fx0) / (mp.mpf(x0) - t) # noqa: B023
h_true = float(mp.quad(integrand, [mp.ninf, x0, mp.inf]) / mp.pi)
assert hilbert_even_profile(x0, _COEFFS, _SCALES).contains(h_true)
# closed form: H[Theta] = sum c_i q_{a_i}
closed = sum(c * (x0 / (x0 * x0 + a * a)) for c, a in zip(_COEFFS, _SCALES, strict=True))
assert abs(h_true - closed) < 1e-11python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_hilbert_even_profile_matches_pv_quadrature[-0.4]" -qRead the implementation
def hilbert_even_profile(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> Interval:
r"""Verified **exact** ``H[Theta](x) = sum_i c_i q_{a_i}(x)`` (odd)."""
return _profile_sum(conjugate_poisson, x, coeffs, scales)Other public import paths
omnibias.core.verified.hilbert_even_profileomnibias.core.verified.line.hilbert_even_profile
hilbert_even_profile_deriv
omnibias.core.verified.hilbert_even_profile_derivSource ↗hilbert_even_profile_deriv(x: float, coeffs: Sequence[float], scales: Sequence[float]) -> IntervalVerified **exact** (H Theta)'(x) = H[Theta'](x) = sum_i c_i q_{a_i}'(x) (even).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
coeffspositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
scalespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
IntervalExecuted regression · hilbert even profile deriv is derivative of hilbert
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hilbert_even_profile_deriv_is_derivative_of_hilbert(x: float) -> None:
# (H Theta)' must equal the mpmath derivative of H[Theta] (closed form sum c_i q'_{a_i}).
with mp.workdps(40):
def h_theta(t: object) -> object:
return sum(c * (t / (t * t + mp.mpf(a) ** 2)) for c, a in zip(_COEFFS, _SCALES, strict=True))
d_true = float(mp.diff(h_theta, x))
assert hilbert_even_profile_deriv(x, _COEFFS, _SCALES).contains(d_true)python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_hilbert_even_profile_deriv_is_derivative_of_hilbert[-0.4]" -qRead the implementation
def hilbert_even_profile_deriv(
x: float, coeffs: Sequence[float], scales: Sequence[float]
) -> Interval:
r"""Verified **exact** ``(H Theta)'(x) = H[Theta'](x) = sum_i c_i q_{a_i}'(x)`` (even)."""
return _profile_sum(conjugate_poisson_deriv, x, coeffs, scales)Other public import paths
omnibias.core.verified.hilbert_even_profile_derivomnibias.core.verified.line.hilbert_even_profile_deriv
hilbert_of_conjugate
omnibias.core.verified.hilbert_of_conjugateSource ↗hilbert_of_conjugate(x: float, a: float) -> IntervalExact line Hilbert transform of the conjugate kernel: H[q_a] = -p_a.
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · hilbert rotation matches pv quadrature
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hilbert_rotation_matches_pv_quadrature(x0: float, a: float) -> None:
# H[p_a] = q_a
h_p = _pv_hilbert(_mp_p, x0, a)
assert hilbert_of_poisson(x0, a).contains(h_p)
assert abs(h_p - x0 / (x0 * x0 + a * a)) < 1e-12
# H[q_a] = -p_a
h_q = _pv_hilbert(_mp_q, x0, a)
assert hilbert_of_conjugate(x0, a).contains(h_q)
assert abs(h_q + a / (x0 * x0 + a * a)) < 1e-12python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_hilbert_rotation_matches_pv_quadrature[-0.4-0.5]" -qRegression example · hilbert rotation is exact closed form
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hilbert_rotation_is_exact_closed_form() -> None:
"""H[q_a] = -p_a and H[p_a] = q_a as interval-equal closed forms."""
for a in (0.7, 1.3):
for x in (-2.0, 0.3, 4.5):
hq = hilbert_of_conjugate(x, a)
mp_neg_p = -a / (x * x + a * a)
assert hq.contains(mp_neg_p)
hp = hilbert_of_poisson(x, a)
assert hp.contains(x / (x * x + a * a))python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_hilbert_rotation_is_exact_closed_form -qRead the implementation
def hilbert_of_conjugate(x: float, a: float) -> Interval:
"""Exact line Hilbert transform of the conjugate kernel: ``H[q_a] = -p_a``."""
return -poisson_kernel(x, a)Other public import paths
omnibias.core.verified.hilbert_of_conjugateomnibias.core.verified.line.hilbert_of_conjugate
hilbert_of_poisson
omnibias.core.verified.hilbert_of_poissonSource ↗hilbert_of_poisson(x: float, a: float) -> IntervalExact line Hilbert transform of the Poisson kernel: H[p_a] = q_a.
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · hilbert rotation matches pv quadrature
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hilbert_rotation_matches_pv_quadrature(x0: float, a: float) -> None:
# H[p_a] = q_a
h_p = _pv_hilbert(_mp_p, x0, a)
assert hilbert_of_poisson(x0, a).contains(h_p)
assert abs(h_p - x0 / (x0 * x0 + a * a)) < 1e-12
# H[q_a] = -p_a
h_q = _pv_hilbert(_mp_q, x0, a)
assert hilbert_of_conjugate(x0, a).contains(h_q)
assert abs(h_q + a / (x0 * x0 + a * a)) < 1e-12python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_hilbert_rotation_matches_pv_quadrature[-0.4-0.5]" -qRegression example · hilbert rotation is exact closed form
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_hilbert_rotation_is_exact_closed_form() -> None:
"""H[q_a] = -p_a and H[p_a] = q_a as interval-equal closed forms."""
for a in (0.7, 1.3):
for x in (-2.0, 0.3, 4.5):
hq = hilbert_of_conjugate(x, a)
mp_neg_p = -a / (x * x + a * a)
assert hq.contains(mp_neg_p)
hp = hilbert_of_poisson(x, a)
assert hp.contains(x / (x * x + a * a))python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_hilbert_rotation_is_exact_closed_form -qRead the implementation
def hilbert_of_poisson(x: float, a: float) -> Interval:
"""Exact line Hilbert transform of the Poisson kernel: ``H[p_a] = q_a``."""
return conjugate_poisson(x, a)Other public import paths
omnibias.core.verified.hilbert_of_poissonomnibias.core.verified.line.hilbert_of_poisson
hilbert_tail_bound
omnibias.core.verified.hilbert_tail_boundSource ↗hilbert_tail_bound(decay_const: float, decay_power: float, x_trunc: float, core_radius: float) -> IntervalRigorous far-field bound on the line Hilbert transform of a decaying profile.
Closes the *continuum tail* obligation for the nonlocal operator. If a profile
obeys |Omega(t)| <= C |t|^{-p} for |t| >= X (p > 0) and the evaluation
point satisfies |x0| <= rho < X, then the contribution of |t| >= X to
H[Omega](x0) = (1/pi) p.v. int Omega(t)/(x0 - t) dt is bounded by
|tail| <= (2 C X^{-p}) / (pi p (1 - rho/X)),
derived from |x0 - t| >= |t|(1 - rho/X) and
int_{|t|>=X} |t|^{-p-1} dt = 2 X^{-p}/p. The returned symmetric
Interval [-B, B] is an outward-rounded enclosure of that bound, so a
finite-domain (or finite-basis) Hilbert evaluation can be upgraded to a rigorous
full-line statement by adding it.
Parameters mirror the inequality: decay_const = C, decay_power = p,
x_trunc = X (truncation radius), core_radius = rho (max |x0|).
Parameters
| Name | Type & default | Contract |
|---|---|---|
decay_constpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
decay_powerpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
x_truncpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
core_radiuspositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExplicit validation & failure cases
- When
decay_power <= 0.0, raisesValueError('decay_power p must be > 0 for the tail to converge'). - When
not (x_trunc > 0.0 and 0.0 <= core_radius < x_trunc), raisesValueError('require 0 <= core_radius < x_trunc and x_trunc > 0'). - When
decay_const < 0.0, raisesValueError('decay_const C must be non-negative').
These are explicit source guards. Backend operations may also raise for invalid shapes, dtypes, or unsupported devices.
Executed regression · tail bound steeper decay is tighter
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_tail_bound_steeper_decay_is_tighter() -> None:
soft = hilbert_tail_bound(decay_const=1.0, decay_power=1.0, x_trunc=50.0, core_radius=1.0).hi
steep = hilbert_tail_bound(decay_const=1.0, decay_power=2.0, x_trunc=50.0, core_radius=1.0).hi
assert steep < softpython -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_tail_bound_steeper_decay_is_tighter" -qRegression example · tail bound rejects bad input
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_tail_bound_rejects_bad_input() -> None:
with pytest.raises(ValueError):
hilbert_tail_bound(decay_const=1.0, decay_power=0.0, x_trunc=10.0, core_radius=1.0)
with pytest.raises(ValueError):
hilbert_tail_bound(decay_const=1.0, decay_power=1.0, x_trunc=1.0, core_radius=2.0)python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_tail_bound_rejects_bad_input -qRead the implementation
def hilbert_tail_bound(decay_const: float, decay_power: float, x_trunc: float,
core_radius: float) -> Interval:
r"""Rigorous far-field bound on the line Hilbert transform of a decaying profile.
Closes the *continuum tail* obligation for the nonlocal operator. If a profile
obeys ``|Omega(t)| <= C |t|^{-p}`` for ``|t| >= X`` (``p > 0``) and the evaluation
point satisfies ``|x0| <= rho < X``, then the contribution of ``|t| >= X`` to
``H[Omega](x0) = (1/pi) p.v. int Omega(t)/(x0 - t) dt`` is bounded by
|tail| <= (2 C X^{-p}) / (pi p (1 - rho/X)),
derived from ``|x0 - t| >= |t|(1 - rho/X)`` and
``int_{|t|>=X} |t|^{-p-1} dt = 2 X^{-p}/p``. The returned symmetric
:class:`Interval` ``[-B, B]`` is an outward-rounded enclosure of that bound, so a
finite-domain (or finite-basis) Hilbert evaluation can be upgraded to a rigorous
full-line statement by adding it.
Parameters mirror the inequality: ``decay_const = C``, ``decay_power = p``,
``x_trunc = X`` (truncation radius), ``core_radius = rho`` (max ``|x0|``).
"""
if decay_power <= 0.0:
raise ValueError("decay_power p must be > 0 for the tail to converge")
if not (x_trunc > 0.0 and 0.0 <= core_radius < x_trunc):
raise ValueError("require 0 <= core_radius < x_trunc and x_trunc > 0")
if decay_const < 0.0:
raise ValueError("decay_const C must be non-negative")
x_iv = Interval.point(x_trunc)
x_neg_p = exp_iv(Interval.point(-decay_power) * ln_iv(x_iv)) # X^{-p}
one_minus = Interval.point(1.0) - Interval.point(core_radius) * x_iv.reciprocal()
denom = _PI * Interval.point(decay_power) * one_minus
bound = Interval.point(2.0) * Interval.point(decay_const) * x_neg_p * denom.reciprocal()
b = bound.hi
return Interval(-b, b)Other public import paths
omnibias.core.verified.hilbert_tail_boundomnibias.core.verified.line.hilbert_tail_bound
poisson_kernel
omnibias.core.verified.poisson_kernelSource ↗poisson_kernel(x: float, a: float) -> IntervalVerified p_a(x) = a / (x^2 + a^2) (even).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · even profile is even and deriv is odd
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_is_even_and_deriv_is_odd() -> None:
for x in (0.3, 1.7, 4.2):
assert even_profile(x, _COEFFS, _SCALES).contains(even_profile(-x, _COEFFS, _SCALES).mid)
d_pos = even_profile_deriv(x, _COEFFS, _SCALES)
d_neg = even_profile_deriv(-x, _COEFFS, _SCALES)
assert d_pos.contains(-d_neg.mid)python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_even_profile_is_even_and_deriv_is_odd" -qRegression example · basis encloses truth
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_basis_encloses_truth(x: float, a: float) -> None:
d = x * x + a * a
assert poisson_kernel(x, a).contains(a / d)
assert conjugate_poisson(x, a).contains(x / d)
assert conjugate_poisson_deriv(x, a).contains((a * a - x * x) / (d * d))
assert poisson_kernel_deriv(x, a).contains(-2.0 * a * x / (d * d))
assert poisson_primitive(x, a).contains(math.atan(x / a))python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_basis_encloses_truth -qRead the implementation
def poisson_kernel(x: float, a: float) -> Interval:
"""Verified ``p_a(x) = a / (x^2 + a^2)`` (even)."""
return Interval.point(a) * _denom(x, a).reciprocal()Other public import paths
omnibias.core.verified.poisson_kernelomnibias.core.verified.line.poisson_kernel
poisson_kernel_deriv
omnibias.core.verified.poisson_kernel_derivSource ↗poisson_kernel_deriv(x: float, a: float) -> IntervalVerified p_a'(x) = -2 a x / (x^2 + a^2)^2 (odd).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · even profile is even and deriv is odd
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_even_profile_is_even_and_deriv_is_odd() -> None:
for x in (0.3, 1.7, 4.2):
assert even_profile(x, _COEFFS, _SCALES).contains(even_profile(-x, _COEFFS, _SCALES).mid)
d_pos = even_profile_deriv(x, _COEFFS, _SCALES)
d_neg = even_profile_deriv(-x, _COEFFS, _SCALES)
assert d_pos.contains(-d_neg.mid)python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_even_profile_is_even_and_deriv_is_odd" -qRegression example · basis encloses truth
This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_basis_encloses_truth(x: float, a: float) -> None:
d = x * x + a * a
assert poisson_kernel(x, a).contains(a / d)
assert conjugate_poisson(x, a).contains(x / d)
assert conjugate_poisson_deriv(x, a).contains((a * a - x * x) / (d * d))
assert poisson_kernel_deriv(x, a).contains(-2.0 * a * x / (d * d))
assert poisson_primitive(x, a).contains(math.atan(x / a))python -m pytest packages/omnibias-core/tests/verified/test_line.py -k test_basis_encloses_truth -qRead the implementation
def poisson_kernel_deriv(x: float, a: float) -> Interval:
"""Verified ``p_a'(x) = -2 a x / (x^2 + a^2)^2`` (odd)."""
num = Interval.point(-2.0) * Interval.point(a) * Interval.point(x)
return num * _denom(x, a).pow_int(2).reciprocal()Other public import paths
omnibias.core.verified.poisson_kernel_derivomnibias.core.verified.line.poisson_kernel_deriv
poisson_matrix
omnibias.core.verified.poisson_matrixSource ↗poisson_matrix(x_nodes: Sequence[float], a_values: Sequence[float]) -> list[list[Interval]][[p_{a_i}(x_j)]] -- appears in U' = H[Omega] = -sum c_i p_{a_i}.
Parameters
| Name | Type & default | Contract |
|---|---|---|
x_nodespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
a_valuespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
list[list[Interval]]Read the implementation
def poisson_matrix(x_nodes: Sequence[float],
a_values: Sequence[float]) -> list[list[Interval]]:
"""``[[p_{a_i}(x_j)]]`` -- appears in ``U' = H[Omega] = -sum c_i p_{a_i}``."""
return _matrix(poisson_kernel, x_nodes, a_values)Other public import paths
omnibias.core.verified.poisson_matrixomnibias.core.verified.line.poisson_matrix
poisson_primitive
omnibias.core.verified.poisson_primitiveSource ↗poisson_primitive(x: float, a: float) -> IntervalVerified \int_0^x p_a = atan(x / a) (odd, bounded).
Parameters
| Name | Type & default | Contract |
|---|---|---|
xpositional-or-keyword | floatRequired | See the operation contract and implementation below. |
apositional-or-keyword | floatRequired | See the operation contract and implementation below. |
IntervalExecuted regression · basis encloses truth
Recorded coverage confirms this test executed the API body. This example belongs to the pinned upstream test suite. It may use fixtures and imports from its full file. Run it from that checkout with its test dependencies installed.
def test_basis_encloses_truth(x: float, a: float) -> None:
d = x * x + a * a
assert poisson_kernel(x, a).contains(a / d)
assert conjugate_poisson(x, a).contains(x / d)
assert conjugate_poisson_deriv(x, a).contains((a * a - x * x) / (d * d))
assert poisson_kernel_deriv(x, a).contains(-2.0 * a * x / (d * d))
assert poisson_primitive(x, a).contains(math.atan(x / a))python -m pytest "packages/omnibias-core/tests/verified/test_line.py::test_basis_encloses_truth[-0.4-0.5]" -qRead the implementation
def poisson_primitive(x: float, a: float) -> Interval:
r"""Verified ``\int_0^x p_a = atan(x / a)`` (odd, bounded)."""
ratio = Interval.point(x) * Interval.point(a).reciprocal()
return atan_iv(ratio)Other public import paths
omnibias.core.verified.poisson_primitiveomnibias.core.verified.line.poisson_primitive
poisson_primitive_matrix
omnibias.core.verified.poisson_primitive_matrixSource ↗poisson_primitive_matrix(x_nodes: Sequence[float], a_values: Sequence[float]) -> list[list[Interval]][[atan(x_j / a_i)]] -- the velocity primitive U = -sum c_i atan(x/a_i).
Parameters
| Name | Type & default | Contract |
|---|---|---|
x_nodespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
a_valuespositional-or-keyword | Sequence[float]Required | See the operation contract and implementation below. |
list[list[Interval]]Read the implementation
def poisson_primitive_matrix(x_nodes: Sequence[float],
a_values: Sequence[float]) -> list[list[Interval]]:
"""``[[atan(x_j / a_i)]]`` -- the velocity primitive ``U = -sum c_i atan(x/a_i)``."""
return _matrix(poisson_primitive, x_nodes, a_values)Other public import paths
omnibias.core.verified.poisson_primitive_matrixomnibias.core.verified.line.poisson_primitive_matrix