vibespatial.kernels.constructive.segmented_union

Segmented union_all kernel: native grouped polygon union.

ADR-0002: CONSTRUCTIVE class – fp64 by design on all devices. ADR-0033: Tier classification – delegates to overlay pipeline (Tier 1 NVRTC

  • Tier 3a CCCL + Tier 2 CuPy) via overlay_union_owned.

ADR-0034: Inherits overlay pipeline precompilation; no new NVRTC source.

Algorithm

CSR offsets are lowered once to compact device grouped metadata. Exact constructive work then runs over all live groups together through grouped overlay or group-local pairwise rounds; empty groups are restored by device scatter. No Python loop dispatches geometry work group by group.

Attributes

cp

Functions

segmented_union_all(...)

Union all geometries within each group. Returns one geometry per group.

segmented_union_all_device_grouped(...)

Exact grouped union from device grouped metadata.

Module Contents

vibespatial.kernels.constructive.segmented_union.cp = None
vibespatial.kernels.constructive.segmented_union.segmented_union_all(geometries: vibespatial.geometry.owned.OwnedGeometryArray, group_offsets: Any, *, dispatch_mode: vibespatial.runtime.ExecutionMode | str = ExecutionMode.AUTO, precision: vibespatial.runtime.precision.PrecisionMode | str = PrecisionMode.AUTO) vibespatial.geometry.owned.OwnedGeometryArray

Union all geometries within each group. Returns one geometry per group.

Parameters

geometriesOwnedGeometryArray

Input polygons (device- or host-resident).

group_offsetsarray-like

CSR-style int32/int64 offsets. Group i contains geometries[group_offsets[i]:group_offsets[i+1]]. Length is n_groups + 1.

dispatch_modeExecutionMode or str

Execution mode hint (AUTO, GPU, CPU).

precisionPrecisionMode or str

Precision mode. CONSTRUCTIVE kernels stay fp64 per ADR-0002.

Returns

OwnedGeometryArray

One geometry per group. May contain MultiPolygon when union produces disconnected regions. Empty groups produce empty Polygon.

vibespatial.kernels.constructive.segmented_union.segmented_union_all_device_grouped(geometries: vibespatial.geometry.owned.OwnedGeometryArray, group_offsets: Any, group_ids: Any, *, output_row_count: int, precision_plan: vibespatial.runtime.precision.PrecisionPlan, empty_output: vibespatial.geometry.owned.OwnedGeometryArray, all_groups_observed: bool | None = None, group_size_min: int | None = None, group_size_max: int | None = None, nonempty_rows_positive_area: bool = False, _skip_rectangle_strip: bool = False, _skip_disjoint_pack: bool = False, _skip_coverage_area_proof: bool = False, _capacity_all_valid_noops: bool = False, _source_segment_span_max: int | None = None) vibespatial.geometry.owned.OwnedGeometryArray | None

Exact grouped union from device grouped metadata.

group_offsets and group_ids are the compact NativeGrouped carriers: rows are already sorted by group, offsets delimit the compact non-empty groups, and group IDs scatter compact results back to public output rows. Grouped overlay and exact pairwise reduction both keep row pairing, carry propagation, and final scatter in device rowsets.