Parma Polyhedra Library requirements
C++ rational-grid conversions

C++ rational-grid conversions

UID:
VERSION:
CLASSIFICATION:
PREFIX:
Type
Level
MID
UID
REFS
Title
Statement
Rationale
Comment
BIBLIOGRAPHY
STATUS
COMPONENT
APPLICABILITY
VERIFICATION_METHODS
VERIFICATION_CRITERIA
SOURCE
LANGUAGE
VISIBILITY
INTERFACE
SW_SPEC
1
PPL-SPEC-001312
PPL-SPEC-001312
Grid construction from boxes

Grid(box,complexity) shall preserve the box's ambient dimension and construct its exact real affine hull as a grid. Empty shall yield empty. Each singleton interval shall fix its coordinate; every non-singleton coordinate shall be free. Open bounds do not add excluded endpoints to a singleton. All complexity choices shall have this meaning, under the source interval's arithmetic conditions and 🔗 1. Rational-grid values, coefficient profile and valid use. The source value shall be preserved. Excess ambient dimension shall throw std::length_error before representation allocation.

The initialization, lifetime, synchronization and computational-arithmetic conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Unless dimension-changing behavior is stated, ambient dimension shall be preserved. Resource and numerical exceptions may propagate; surviving ownership shall permit destruction, without an assumed rollback or guarantee that further queries are valid. Receiver-owned views may be invalidated as in 🔗 10. Borrowed congruence and generator views of grid values.

A Cartesian box contributes only fixed-coordinate equalities to its affine hull.

BagnaraDHMZ07 | Section 3, grid definitions, representations and operations.

APPROVED
GRIDS
IF_CPP
Test, Analysis, Inspection

Compare rational/open/closed/unbounded and empty boxes with independently selected singleton-coordinate equations, both numerical representations and dimension boundaries. Exercise empty, universe, fixed, mixed and open non-singleton boxes at dimensions 63, 64 and 65 and above, with every complexity choice. Compare each reconstructed minimal representation and subsequent prefix projections with independent fixed-coordinate equations. Check preservation of the source box and of the floating-point rounding mode and exception flags for dyadic floating bounds. Compare canonical endpoint pairs with equal numerators and unequal denominators, different numerators and equal denominators, equal fractions and canonical zero. Check both extracted fractions and the resulting fixed or free coordinate. Check negative integer and dyadic singleton coordinates through positive canonical bound denominators, including preservation of the source box and floating environment. Inspect LCM-scaled anchors before minimizing queries: compare literal primitive coordinates and positive divisors for free, mixed and fixed axes, coprime and nested denominators, and confirm that reading the generator view leaves the serialized representation unchanged.

src/Grid_defs.hh; src/Grid_inlines.hh; src/Grid_public.cc; src/Grid_nonpublic.cc; src/Grid_templates.hh; tests/Grid/frombox1.cc; tests/gridoperationsspec1.cc; tests/gridedgespec1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Member declarations of Grid.

template <typename Interval>
explicit Grid(const Box<Interval>& box,
              Complexity_Class complexity = ANY_COMPLEXITY);
SW_SPEC
2
PPL-SPEC-001313
PPL-SPEC-001313
Grid construction from bounded-difference shapes

Grid(bd,complexity) shall preserve ambient dimension and construct the exact real affine hull of the bounded-difference shape, including empty. It shall retain all implied affine equalities under the source shape's arithmetic preconditions and 🔗 1. Rational-grid values, coefficient profile and valid use, for every complexity choice. The source's mathematical value shall be preserved; closure caches may change. Excess ambient dimension shall throw std::length_error before representation allocation.

The initialization, lifetime, synchronization and computational-arithmetic conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Unless dimension-changing behavior is stated, ambient dimension shall be preserved. Resource and numerical exceptions may propagate; surviving ownership shall permit destruction, without an assumed rollback or guarantee that further queries are valid. Receiver-owned views may be invalidated as in 🔗 10. Borrowed congruence and generator views of grid values.

Tight opposite difference bounds identify all affine equalities of a nonempty bounded-difference shape.

BagnaraDHMZ07 | Section 3, grid definitions, representations and operations.

APPROVED
GRIDS
IF_CPP
Test, Analysis, Inspection

Use independently known equalities and strict inequalities among rational difference constraints, redundant/latent-empty source descriptions, all complexity values and source preservation.

src/Grid_defs.hh; src/Grid_inlines.hh; src/Grid_public.cc; src/Grid_nonpublic.cc; src/Grid_templates.hh; tests/Grid/frombdshape1.cc; tests/gridoperationsspec1.cc; tests/gridedgespec1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Member declarations of Grid.

template <typename U>
explicit Grid(const BD_Shape<U>& bd,
              Complexity_Class complexity = ANY_COMPLEXITY);
SW_SPEC
3
PPL-SPEC-001314
PPL-SPEC-001314
Grid construction from octagonal shapes

Grid(os,complexity) shall preserve ambient dimension and construct the exact real affine hull of the octagonal shape, including empty, under its arithmetic preconditions and 🔗 1. Rational-grid values, coefficient profile and valid use. Every complexity choice shall retain the implied affine equalities. The source's mathematical value shall be preserved; closure caches may change. Excess ambient dimension shall throw std::length_error before representation allocation.

The initialization, lifetime, synchronization and computational-arithmetic conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Unless dimension-changing behavior is stated, ambient dimension shall be preserved. Resource and numerical exceptions may propagate; surviving ownership shall permit destruction, without an assumed rollback or guarantee that further queries are valid. Receiver-owned views may be invalidated as in 🔗 10. Borrowed congruence and generator views of grid values.

Tight opposite octagonal bounds determine the affine equalities of the shape.

BagnaraDHMZ07 | Section 3, grid definitions, representations and operations.

APPROVED
GRIDS
IF_CPP
Test, Analysis, Inspection

Check fixed coordinates, sum/difference equalities, open affine freedom, redundant rows and latent emptiness across complexity choices, source caches and numerical profiles.

src/Grid_defs.hh; src/Grid_inlines.hh; src/Grid_public.cc; src/Grid_nonpublic.cc; src/Grid_templates.hh; tests/Grid/fromoctagonalshape1.cc; tests/gridoperationsspec1.cc; tests/gridedgespec1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Member declarations of Grid.

template <typename U>
explicit Grid(const Octagonal_Shape<U>& os,
              Complexity_Class complexity = ANY_COMPLEXITY);
SW_SPEC
4
PPL-SPEC-001315
PPL-SPEC-001315
Grid construction from polyhedra

Grid(ph,complexity) shall preserve ambient dimension and contain the polyhedron's real affine hull. With ANY_COMPLEXITY it shall equal that affine hull, including for NNC polyhedra and empty. Restricted complexity may retain only explicit available equalities and may fail to detect latent emptiness, giving a coarser grid. If generators are used, supporting points, closure points, rays and lines shall contribute their real affine span. Marked empty and zero-dimensional empty shall yield empty in every complexity class. The source value shall be preserved, though caches may change. Excess ambient dimension shall throw std::length_error before representation allocation.

The initialization, lifetime, synchronization and computational-arithmetic conditions in 🔗 1. Rational-grid values, coefficient profile and valid use shall apply, including intermediate calculations. Unless dimension-changing behavior is stated, ambient dimension shall be preserved. Resource and numerical exceptions may propagate; surviving ownership shall permit destruction, without an assumed rollback or guarantee that further queries are valid. Receiver-owned views may be invalidated as in 🔗 10. Borrowed congruence and generator views of grid values.

For a bounded coefficient profile, directions joining rational points shall be computed from complete cross-products of their numerators and divisors, then reduced by a common positive factor before their coefficients are admitted. Constants and NNC epsilon coordinates shall not contribute to these line directions. This projective normalization shall not rescale a lattice parameter.

An exact affine hull can require constraint minimization; a complexity-limited conversion may conservatively omit hidden equalities.

BagnaraDHMZ07 | Section 3, grid definitions, representations and operations.

APPROVED
GRIDS
IF_CPP
Test, Analysis, Inspection

Compare exact conversions with independent affine spans of C/NNC polyhedral generators, hidden equalities and emptiness; check sound limited-complexity outputs, source preservation, dimensions and zero-dimensional cases.

src/Grid_defs.hh; src/Grid_inlines.hh; src/Grid_public.cc; src/Grid_nonpublic.cc; src/Grid_templates.hh; tests/Grid/frompolyhedron1.cc; tests/gridoperationsspec1.cc; tests/gridedgespec1.cc.

CPP
Public

Public header: <ppl.hh>; namespace Parma_Polyhedra_Library. Member declarations of Grid.

explicit Grid(const Polyhedron& ph,
              Complexity_Class complexity = ANY_COMPLEXITY);