Skip to main content

omnibias.jax.architectures.integral_kernel

0.5.0rc1Release candidatePython >=3.10Apache-2.0

JAX activation derivatives, functional network jets, direct contractions, and parameter-differentiable numerical models.

import omnibias.jax.architectures.integral_kernel
Module contract & mathematical conventions

Integral-kernel operator (jax; theory 09-14).

The kernel cell is the OMBU integral role. founding bias collapse (delta -> 0) of the window is not the default. Temperature collapse (beta -> inf, feasibility) does not appear. do not conflate the two.

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.

Imports & aliases​

These names share a definition with another public module. Follow a name for its full contract, parameters, and examples.

Import from this moduleCanonical reference
DISCLAIMERomnibias.core.integral_kernel.DISCLAIMER
IntegralKernelConfigomnibias.core.integral_kernel.IntegralKernelConfig
honesty_payloadomnibias.core.integral_kernel.honesty_payload
FUNCTION

integral_cell​

omnibias.jax.architectures.integral_kernel.integral_cellSource ↗
integral_cell(z: Array, b_lo: float, b_hi: float) -> Array

S(z + b_hi) - S(z + b_lo). Matches OperatorBlock(op='integral').

Parameters

NameType & defaultContract
zpositional-or-keywordArrayRequiredSee the operation contract and implementation below.
b_lopositional-or-keywordfloatRequiredSee the operation contract and implementation below.
b_hipositional-or-keywordfloatRequiredSee the operation contract and implementation below.
ReturnsArray
Executed regression · g1

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_g1() -> None:
    ex = worked_example()
    assert ex["g1_err"] < 1e-12
    z = jnp.asarray([0.5])
    cell = float(integral_cell(z, -0.5, 0.5)[0])
    assert abs(cell - core_cell(0.5, -0.5, 0.5)) < 1e-12
python -m pytest "packages/omnibias-jax/tests/test_integral_kernel.py::test_g1" -q
Regression example · g4 bit identical

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_g4_bit_identical() -> None:
    torch.set_default_dtype(torch.float64)
    assert torch_ex()["g1_cell"] == jax_ex()["g1_cell"]
    t = float(torch_cell(torch.tensor([0.5]), -0.5, 0.5)[0])
    j = float(jax_cell(jnp.asarray([0.5]), -0.5, 0.5)[0])
    assert t == j
python -m pytest tests/test_integral_kernel_parity.py -k test_g4_bit_identical -q
Read the implementation
def integral_cell(z: Array, b_lo: float, b_hi: float) -> Array:
    """``S(z + b_hi) - S(z + b_lo)``. Matches ``OperatorBlock(op='integral')``."""
    arr = jnp.asarray(z)
    vals = [core.integral_cell(float(v), b_lo, b_hi) for v in arr.reshape(-1).tolist()]
    return jnp.asarray(vals, dtype=arr.dtype).reshape(arr.shape)
FUNCTION

integral_kernel_apply​

omnibias.jax.architectures.integral_kernel_applySource ↗
integral_kernel_apply(source: Array, coords: Array, params: Sequence[float] | None=None, *, config: IntegralKernelConfig | None=None, nodes: Array | None=None) -> Array

Volumetric apply. Not BEM-Net.

Parameters

NameType & defaultContract
sourcepositional-or-keywordArrayRequiredSee the operation contract and implementation below.
coordspositional-or-keywordArrayRequiredSee the operation contract and implementation below.
paramspositional-or-keywordSequence[float] | NoneDefault: NoneSee the operation contract and implementation below.
configkeyword-onlyIntegralKernelConfig | NoneDefault: NoneSee the operation contract and implementation below.
nodeskeyword-onlyArray | NoneDefault: NoneSee the operation contract and implementation below.
ReturnsArray
Read the implementation
def integral_kernel_apply(
    source: Array,
    coords: Array,
    params: Sequence[float] | None = None,
    *,
    config: IntegralKernelConfig | None = None,
    nodes: Array | None = None,
) -> Array:
    """Volumetric apply. Not BEM-Net."""
    arr = jnp.asarray(coords)
    src = [float(v) for v in jnp.asarray(source).reshape(-1).tolist()]
    xs = [float(v) for v in arr.reshape(-1).tolist()]
    ys = (
        [float(v) for v in jnp.asarray(nodes).reshape(-1).tolist()]
        if nodes is not None
        else None
    )
    out = core.integral_kernel_apply(src, xs, params, config=config, nodes=ys)
    return jnp.asarray(out, dtype=arr.dtype)
Other public import paths
  • omnibias.jax.architectures.integral_kernel_apply
  • omnibias.jax.architectures.integral_kernel.integral_kernel_apply
FUNCTION

worked_example​

omnibias.jax.architectures.integral_kernel.worked_exampleSource ↗
worked_example() -> dict[str, float]

The module contract describes the context for this operation. Its signature, explicit validation, return expressions, and implementation are recorded below.

Returnsdict[str, float]
Executed regression · g1

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_g1() -> None:
    ex = worked_example()
    assert ex["g1_err"] < 1e-12
    z = jnp.asarray([0.5])
    cell = float(integral_cell(z, -0.5, 0.5)[0])
    assert abs(cell - core_cell(0.5, -0.5, 0.5)) < 1e-12
python -m pytest "packages/omnibias-jax/tests/test_integral_kernel.py::test_g1" -q
Regression example · g4 bit identical

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_g4_bit_identical() -> None:
    torch.set_default_dtype(torch.float64)
    assert torch_ex()["g1_cell"] == jax_ex()["g1_cell"]
    t = float(torch_cell(torch.tensor([0.5]), -0.5, 0.5)[0])
    j = float(jax_cell(jnp.asarray([0.5]), -0.5, 0.5)[0])
    assert t == j
python -m pytest tests/test_integral_kernel_parity.py -k test_g4_bit_identical -q
Read the implementation
def worked_example() -> dict[str, float]:
    return core.worked_example()