curve_locality — MATH construct op

• Data kinds: pairs → table

• Call: import fullseye as fs; fs.ledger.curve_locality(points, gaps=(1, 2, 4, 8, 16, 32)) (to call the implementation directly, import mathops; mathops.curve_locality(points, gaps=(1, 2, 4, 8, 16, 32)); from the registry, opsmath.get("curve_locality"))

Usage

Points `k` apart along the curve — how far apart are they on the plane?

The reason a space-filling curve is used for storage layout, texture tiling

or rendering order is locality: neighbours in the ordering should stay

neighbours in space. This op measures that directly — for each gap `k` it

returns the mean Euclidean distance between points `i and i + k`.

★Why this earns its place: the claim "Hilbert has better locality than

scanning row by row" is usually asserted and never measured. Here it is a

table you can read: a Hilbert curve grows roughly as `sqrt(k)` (measured

1.00 / 1.53 / 2.12 / 3.17 / 4.29 / 6.38 at k = 1 .. 32), while a boustrophedon

scan grows nearly linearly (1.00 / 1.96 / 3.79 / 7.07 / 12.12 / 16.07) —

an honest, reproducible gap rather than a slogan.

Parameters

----------

points : (N, 2) array

The curve's points in visiting order.

gaps : ints

Index gaps to report. Gaps at or beyond `N` are dropped (not an error;

a short curve simply has nothing to say about a long gap).

Returns a `table: gap (int), mean_distance, and ratio` =

`mean_distance / mean_distance[gap == 1]` so curves of different scales can

be compared directly.

Raises `ValueError`: not an (N, 2) array; fewer than 2 points;

non-finite coordinates; every requested gap out of range.

HALCON: no operator.

Family-wide input contract (fail-closed)

Every mathops op validates its input before computing (nothing slips through silently):

• **complex input raises ValueError** — coercing to float64 silently discards the imaginary part (numpy only emits a ComplexWarning and returns a plausible-looking wrong real number). State .real/.imag/abs() explicitly, or use complexops, which handles complex data.

• **masked arrays with masked elements raise ValueError** — the implicit conversion that peels off the mask and uses the raw values underneath is refused. Say explicitly whether to fill or to drop.

• **NaN/Inf raises ValueError on every input** (refused with the count stated — it propagates through the whole result).

• Shapes are strict: 1-D and 2-D are never implicitly promoted or broadcast (a matrix in a vector slot, or a vector in a matrix slot, raises ValueError; reshape explicitly).

• Size cap: ops that take a matrix, and the stat_histogram bins, raise ValueError beyond mathops.MAX_ELEMENTS (2^26 ≈ 67 million elements).

Detailed usage guide

• math_metrology family guide

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

• poc_theorems_as_pictures — py -3.11 examples/poc_theorems_as_pictures.py

Ops the type connects to (they accept table as input)

dynsys_poincare_section

Same category (construct)

circle_packing_apollonian · ford_circles · phyllotaxis_pattern · neighbour_index_gaps · ifs_fractal · ifs_similarity_dimension · space_filling_curve


*Provenance: mathops.py — MATH operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.