Parma Polyhedra Library requirements
C++ generator distances and stored ordering
PPL-SPEC-001579
1. Rectilinear distance between generator points PPL-SPEC-001579

For admitted generators with rational coordinates as specified by 🔗 4. Generator-distance admission, workspaces and dispatch, rectilinear_distance_assign shall assign the requested directed bound on

D1(x, y) = n − 1∑i = 0|xi − yi|.

With exact rational temporary arithmetic and an exactly representable output, the sum shall be returned exactly.

The admission, direction, workspace, alias, lifetime and failure conditions of 🔗 4. Generator-distance admission, workspaces and dispatch shall apply. Successful completion shall return true; rejection shall return false with the stated preservation. An upward result shall be at least the exact norm and a downward result shall be nonnegative and at most the exact norm, under the numerical prerequisites. Both source generators shall retain their values, kinds, representations and dimensions.

PPL-SPEC-001580
2. Euclidean distance between generator points PPL-SPEC-001580

For admitted generators with rational coordinates as specified by 🔗 4. Generator-distance admission, workspaces and dispatch, euclidean_distance_assign shall assign the requested directed bound on

D2(x, y) = √(n − 1∑i = 0(xi − yi)2).

Every squared contribution shall preserve the directed bound even when a coordinate difference is inexact in the workspace type. Rational square roots shall retain the precision and enclosure conditions of 🔗 2. Finite rational square root at the selected irrational precision and 🔗 3. Selection and ownership of irrational rational precision; no universal exactness or fixed error width shall be inferred beyond those contracts.

The admission, direction, workspace, alias, lifetime and failure conditions of 🔗 4. Generator-distance admission, workspaces and dispatch shall apply. Successful completion shall return true; rejection shall return false with the stated preservation. An upward result shall be at least the exact norm and a downward result shall be nonnegative and at most the exact norm, under the numerical prerequisites. Both source generators shall retain their values, kinds, representations and dimensions.

PPL-SPEC-001581
3. Maximum-coordinate distance between generator points PPL-SPEC-001581

For admitted generators with rational coordinates as specified by 🔗 4. Generator-distance admission, workspaces and dispatch, l_infinity_distance_assign shall assign the requested directed bound on

D∞(x, y) =  max0 ≤ i < n|xi − yi|.

The maximum over the empty coordinate tuple shall be zero. With exact rational temporary arithmetic and an exactly representable output, the maximum shall be returned exactly.

The admission, direction, workspace, alias, lifetime and failure conditions of 🔗 4. Generator-distance admission, workspaces and dispatch shall apply. Successful completion shall return true; rejection shall return false with the stated preservation. An upward result shall be at least the exact norm and a downward result shall be nonnegative and at most the exact norm, under the numerical prerequisites. Both source generators shall retain their values, kinds, representations and dimensions.

4. Generator-distance admission, workspaces and dispatch PPL-SPEC-001582

Distances shall be admitted exactly when both generators are points or closure points and have the same ambient dimension. A line, a ray or a dimension mismatch shall return false before assigning the output or any supplied scratch object. Equal-dimensional point/closure-point pairs shall return true on successful numerical completion. A zero-dimensional pair shall assign exact zero. A closure point shall contribute its rational coordinates without asserting inclusion in any polyhedron. For each source, xi = ai ⁄ d shall use its own positive divisor. Neither coefficient vectors alone nor homogeneous-coordinate distances shall replace these coordinates. Boolean success shall not imply exactness of a rounded result.

The default overload shall use three Checked_Number<To,Extended_Number_Policy> workspaces. An explicit scalar temporary type Temp shall use three Checked_Number<Temp,Extended_Number_Policy> workspaces. Supplied references shall use their actual admitted raw or checked numerical type Work. Their accumulation shall use 🔗 17. Rectilinear distance between bound-entry arrays, 🔗 18. Euclidean distance between bound-entry arrays or 🔗 19. Maximum-coordinate distance between bound-entry arrays, respectively. The generic helper instantiated with the corresponding specialization shall use the same admission, coordinate and numerical rules.

Source validity and coefficient conditions of 🔗 1. Generator kinds and numerical prerequisites shall apply. Each scalar conversion, subtraction, accumulation, square, square root and final assignment shall satisfy its backend's representability, failure, resource, shared-temporary, nontrapping and FPU prerequisites. Native floating types shall retain their configured availability and hardware conditions. Rational square-root precision shall remain stable throughout a dependent call. Calls evaluating coordinate differences shall use ROUND_UP or ROUND_DOWN, optionally with ROUND_STRICT_RELATION. Inexact coordinate conversion shall not by itself invalidate a directed bound. The zero-dimensional exact assignment shall admit any otherwise valid direction for that scalar assignment.

Supplied scratch objects shall be pairwise distinct and disjoint from both source generators. Their entry values need not be initialized where they are overwritten before reading. The output shall have live assignable storage disjoint from the sources; it may coincide with any one scratch object or its compatible raw storage. The same generator may be passed as both sources. Callers shall preserve object and borrowed-storage lifetimes and provide synchronization required by the selected numerical profile. Numerical or allocation failures may propagate through their declared channels, shall not establish a successful directed bound, and may leave partial output/scratch values according to the selected scalar policies; no aggregate rollback guarantee shall be inferred.

  • PPL-LLR-000015
    5. Distinct meanings of geometric generators PPL-LLR-000015

    Generator descriptors shall preserve the mathematical distinction between included points, closure points, rays, lines and grid parameters: closure points need not be included points, rays admit nonnegative displacement, lines admit arbitrary real displacement, and grid parameters admit integer displacement.

    • PPL-HLR-000001
      1. Numerical and geometric foundations PPL-HLR-000001

      PPL shall provide numerical values and finite-dimensional geometric descriptors with defined mathematical meanings, so that clients can describe numerical problems consistently across the library.

  • PPL-LLR-000311
    1. Public C++ access to supported facilities PPL-LLR-000311

    The public C++ interface shall expose the configured library's supported numerical facilities and their public value types through the documented public headers, preserving the declared numerical meanings and public type contracts of those facilities.

    • PPL-HLR-000007
      7. Access through supported language interfaces PPL-HLR-000007

      PPL shall expose its numerical facilities through its C++ interface and expose selected facilities through the supported C, Java, OCaml and Prolog interfaces. Each interface shall preserve the declared semantics of the facilities it exposes.

  • 4. Explicit numerical operation contracts PPL-LLR-000442

    Each supported numerical operation shall have an explicit contract identifying its concrete meaning, the conditions of its numerical guarantees, and the meaning of its exact, approximate, inconclusive and failure outcomes, as applicable. The contract shall identify its applicable domain, numerical profile and interface contexts; restrictions on availability or precision shall be consistent with the required facility and selected configuration.

    • PPL-HLR-000011
      11. Sound and explicit numerical guarantees PPL-HLR-000011

      PPL shall distinguish exact numerical results, conservative approximations and inconclusive outcomes, and shall make the assumptions and precision guarantees of each numerical operation explicit.

PPL-SPEC-001583
5. Stored ordering of polyhedral generators PPL-SPEC-001583

compare(x,y) shall order valid generator rows of the same topology without changing either source. Callers shall provide this common-topology precondition, as in rows of one generator system. Its result shall be negative, zero or positive according to the stored ordering, with magnitude at most two. Lines shall precede all other kinds, returning magnitude two when this rule decides the order.

For two necessarily-closed rows, comparison shall use their stored expressions: homogeneous coefficients in increasing variable order followed by the divisor field, with absent trailing coefficients treated as zero. A homogeneous coefficient difference shall return magnitude two and a divisor-field difference magnitude one, using the sign of the first difference.

For NNC rows, comparison shall first use the public homogeneous coefficients in the same order with zero padding. A difference shall return magnitude two. With equal homogeneous coefficients, two lines shall compare equal; otherwise a ray shall precede a point or closure point with magnitude one, and two rays shall compare equal. Remaining point or closure-point rows shall compare divisors and then stored epsilon coefficients, returning their signed comparison with magnitude one when unequal.

The ordering shall be of stored row descriptions, not lexicographic order of rational point coordinates and not generator equivalence. Source validity, coefficient representability and synchronization prerequisites of 🔗 1. Generator kinds and numerical prerequisites shall apply.

PPL-SPEC-001653
6. Admitted generator-distance evaluation kernel PPL-SPEC-001653

l_m_distance_assign_impl shall evaluate a valid point or closure-point pair of equal strictly positive dimension. Callers shall meet the source, workspace, output-alias, rounding, initialization, synchronization and backend conditions of 🔗 4. Generator-distance admission, workspaces and dispatch before entering this kernel; it shall not perform the public admission checks.

With Skip_Common_Zero_Runs equal to false, the kernel shall process every coordinate in decreasing index order, using each source's own positive divisor. It shall initialize tmp0 to zero, form the directed nonnegative coordinate differences, call Specialization::combine once for each coordinate, call Specialization::finalize once after accumulation, and assign the result from tmp0. The applicable numerical obligations of 🔗 1. Rectilinear distance between generator points, 🔗 2. Euclidean distance between generator points or 🔗 3. Maximum-coordinate distance between generator points shall apply for their corresponding standard specialization.

With Skip_Common_Zero_Runs equal to true, both sources shall have sparse representation and Specialization shall be the standard rectilinear, Euclidean or infinity-distance specialization for Work. The kernel may replace a maximal run of coordinates zero in both sources by one ordinary zero-coordinate step. Successful completion shall preserve the full traversal's result, final scratch values, directed rounding and floating-point zero signs and status effects. Contributions at nonzero coordinates shall retain their decreasing-index order. The skipping path shall not allocate coefficient vectors or polymorphic expression iterators.

Successful numerical completion shall return true. Numerical or allocation failures shall retain the failure channels and partial-state conditions of 🔗 4. Generator-distance admission, workspaces and dispatch. The public dispatcher shall retain ordinary traversal for other specialization types; callbacks of those types shall not lose coordinate invocations.