Parma Polyhedra Library requirements
Internal square bound-matrix interfaces

Internal square bound-matrix interfaces

1. Square bound-matrix values and valid ownership
UID: PPL-SPEC-000751
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

DB_Matrix<T> shall own a square coordinate-indexed array of T entries, stored as independently owned DB_Row<T> rows. Row/column coordinates shall determine entry identity; neither spare capacity nor row-owner addresses shall change represented array values. Each selected element operation shall retain 🔗 1. Extended-number row meaning and construction states and its supported arithmetic, rounding, resource, initialization and synchronization prerequisites. Every admitted dimension shall fit both advertised row and column bounds, with representable capacity and memory calculations.

Mutable row access shall not permit clients to break the matrix shape: callers shall retain each row's logical size and actual shared capacity when returning to matrix operations. Storage access/copying may carry the selected element type's valid extended values; operations requiring only finite or positive-infinite bound values shall state that scope separately. Borrowed rows and coefficients shall remain subject to their owner's lifetime and the selected mutation's invalidation rules.

RATIONALE:

A square storage interface needs exact coordinates and ownership rules without confusing raw entries with higher-level closed difference-bound shapes.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

template <typename T> class DB_Matrix;
VERIFICATION_CRITERIA:

Compare independently indexed arrays through constructed/copy/mutation histories and verify row sizes, owner independence and actual entry addresses.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000752
2. Empty and sized matrix construction and dimension limits
UID: PPL-SPEC-000752
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Default construction shall create a zero-by-zero matrix with no logical rows and an empty row range. Construction with admitted dimension n shall create exactly n rows of n entries each, initially positive infinity at every coordinate, including the diagonal. Zero dimension shall be admitted by either form. Destruction shall release every owned row and coefficient exactly once.

max_num_rows() shall report the supported row-container count bound, and max_num_columns() the supported DB_Row<T> count bound. Square construction shall require both bounds; they shall not promise enough available memory to realize the advertised maximum. Construction failure shall retain 🔗 16. Incomplete matrix cleanup and operation-specific failure guarantees.

RATIONALE:

Raw bound matrices start unconstrained at every coordinate; semantic diagonal conventions belong to their higher-level owners.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

DB_Matrix();
explicit DB_Matrix(dimension_type n);
~DB_Matrix();
static dimension_type max_num_rows();
static dimension_type max_num_columns();
VERIFICATION_CRITERIA:

Check default/sized zero matrices, every cell of several positive dimensions, row/column bound consistency and exact resource cleanup after construction failure.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000753
3. Independent matrix copy construction
UID: PPL-SPEC-000753
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Ordinary copying shall create the same square dimension and exactly the source's entry values in independently owned rows. It shall preserve the source, and changes or destruction of either owner shall not change the other's entries. Physical spare capacities need not be copied exactly. A source supplied through an rvalue shall use ordinary copying; no distinct move constructor shall be required. Empty sources shall copy as empty matrices. Failed copying shall release the incomplete target and preserve the source under 🔗 16. Incomplete matrix cleanup and operation-specific failure guarantees.

RATIONALE:

Exact array copying must preserve coordinate values independently of the storage owners and capacity choices.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

DB_Matrix(const DB_Matrix& y);
VERIFICATION_CRITERIA:

Compare independent cell expectations, row/coefficient addresses, source mutation/destruction, empty sources, rvalue copying and multi-limb rational/integer values.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000754
4. Pointwise upward matrix conversion
UID: PPL-SPEC-000754
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Cross-element-type construction shall create the same square dimension and an independent row at every source coordinate. Its entry conversion shall follow 🔗 7. Pointwise upward conversion of extended-number rows: finite successful conversions shall bound the exact source upward, exact representable values shall remain exact, and supported extended values shall retain their meanings. The source shall remain unchanged; an empty source shall yield an empty target. Source/target policies shall admit every requested conversion and rounding direction, including all intermediates. Failure shall follow 🔗 16. Incomplete matrix cleanup and operation-specific failure guarantees.

RATIONALE:

Changing bound representation must round outward at each actual matrix coordinate rather than change row/column associations.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

template <typename U> explicit DB_Matrix(const DB_Matrix<U>& y);
VERIFICATION_CRITERIA:

Compare signed rational cells with independent GMP ceilings for integral targets and exact same-value conversions for rational targets, including positive infinity, empty matrices and source preservation.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

5. Matrix value assignment and exceptional target state
UID: PPL-SPEC-000755
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Successful assignment shall replace the target by the source dimension and independently owned entry values and return the target wrapper. The source shall be preserved. Self-assignment shall retain all entries, dimension and capacity metadata without rebuilding the row container.

A reported recoverable failure during assignment may leave a partially replaced target. Its completed objects and owned allocations shall remain safely destructible; no square value or coherent old/new mathematical result shall be claimed for that target. A complete subsequent assignment from a valid owner may establish a new valid value. Source state and temporary-resource cleanup shall retain 🔗 16. Incomplete matrix cleanup and operation-specific failure guarantees.

RATIONALE:

Vector-of-row assignment can replace rows incrementally, so a failed value replacement needs a distinct permitted state from successful square copying.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

DB_Matrix& operator=(const DB_Matrix& y);
VERIFICATION_CRITERIA:

Check independent assignment across dimensions and source destruction, self-assignment and source preservation; inject allocation/element-copy failures and verify safe target destruction or complete replacement.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000756
6. Whole-matrix ownership exchange
UID: PPL-SPEC-000756
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Member and free swap shall exchange the complete row containers, logical dimensions and associated row-capacity metadata without coefficient copying or allocation. Empty and nonempty matrices and self-swap shall be admitted. Existing borrowed row/entry objects shall retain their identity and values while their owning storage remains alive, with ownership transferred to the other wrapper. Endpoints and future queries shall be obtained from the appropriate resulting owner.

RATIONALE:

Swapping matrix owners must carry dimensions and capacities together with the actual numerical storage.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

void m_swap(DB_Matrix& y);
template <typename T> void swap(DB_Matrix<T>& x, DB_Matrix<T>& y);
VERIFICATION_CRITERIA:

Retain row/entry addresses through empty/nonempty and self-swaps, compare complete independent arrays, and inject allocation/element-copy failures that must remain unconsumed.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000757
7. Dimensions, indexed rows and array equality
UID: PPL-SPEC-000757
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

num_rows() shall return the square array dimension. Subscript at 0 ≤ i < n shall return the actual mutable or const row at index i; valid coefficient access shall retain 🔗 5. Row sizes, supported limits, coefficient ranges and equality. Const access shall not expose mutable entries. Equality shall mean equal square dimensions and pairwise equal values at every coordinate under the selected T comparison. Inequality shall negate it. Capacity, independent copies and row-owner addresses shall not affect that result. These queries shall not modify entries.

Member overloads that return references, iterators or nonowning views into the owner shall require an lvalue owner. Matching rvalue calls that would produce such borrows shall be rejected during overload resolution. Temporary iterator and row-view values shall remain usable while their backing owner remains alive.

RATIONALE:

Square array identity is a coordinatewise value property, independent of storage representation.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

dimension_type num_rows() const;
DB_Row<T>& operator[](dimension_type i) &;
const DB_Row<T>& operator[](dimension_type i) const &;
template <typename T> bool operator==(const DB_Matrix<T>& x, const DB_Matrix<T>& y);
// Inequality uses C++20 rewriting of operator==.
VERIFICATION_CRITERIA:

Check Boolean inequality expressions in both operand orders through C++20 equality rewriting, retaining the stated equality and mismatch behavior. Check every indexed row/entry address, empty dimensions, unequal dimensions, equal copies and a changed cell at each coordinate against independent arrays. Check lvalue admission and temporary-owner rejection with compile-time client expressions. Preserve temporary iterator/view use and lvalue storage identity in runtime checks.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc. tests/rowstoragespec1.cc.

PPL-SPEC-000758
8. Read-only forward row iterators
UID: PPL-SPEC-000758
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

The row iterator shall provide a read-only forward range over actual DB_Row<T> objects. Dereference and arrow shall borrow the exact occupied row, preserving const qualification; prefix increment shall advance and return the same wrapper, and postfix shall return the prior position while advancing. Copies/assignment shall retain the same borrowed position independently; compatible position equality/inequality shall follow the underlying row-vector iterator. Its category shall be std::forward_iterator_tag and its remaining iterator aliases shall retain those of the underlying const row-vector iterator.

Default construction shall value-initialize the underlying position, usable under its singular-position rules. Explicit construction shall admit a current compatible std::vector<DB_Row<T>>::const_iterator. Array endpoints shall be queried from their owner; empty begin/end shall compare equal. Element access shall exclude end, and advancement shall stay within the live range. Clients shall reacquire row iterators after container-replacing or size-changing mutations.

Member overloads that return references, iterators or nonowning views into the owner shall require an lvalue owner. Matching rvalue calls that would produce such borrows shall be rejected during overload resolution. Temporary iterator and row-view values shall remain usable while their backing owner remains alive.

RATIONALE:

Read-only row traversal must expose real const rows, rather than temporary copies or mutable aliases.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

class const_iterator;
const_iterator begin() const &;
const_iterator end() const &;
// Members of DB_Matrix<T>::const_iterator:
const_iterator();
explicit const_iterator(const typename std::vector<DB_Row<T>>::const_iterator& b);
const_iterator(const const_iterator& y);
const_iterator& operator=(const const_iterator& y);
reference operator*() const;
pointer operator->() const;
const_iterator& operator++();
const_iterator operator++(int);
bool operator==(const const_iterator& y) const;
// Inequality uses C++20 rewriting of operator==.
VERIFICATION_CRITERIA:

Check Boolean inequality expressions in both operand orders through C++20 equality rewriting, retaining the stated equality and mismatch behavior. Check forward iterator traits, every row address, copied multipass positions, prefix/postfix return identities, default binding/assignment, empty ranges and an explicit adapter over an independent row vector. Check lvalue admission and temporary-owner rejection with compile-time client expressions. Preserve temporary iterator/view use and lvalue storage identity in runtime checks.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc. tests/rowstoragespec1.cc.

9. Growth preserves the old square and adds infinity coordinates
UID: PPL-SPEC-000759
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Growth shall require an admitted new dimension at least the current dimension. It shall produce that new square, preserving every old coordinate's value in the upper-left common square and initializing every newly introduced row or column position to positive infinity. Equal-dimension growth shall preserve the existing value. Storage may be recycled or replaced; clients shall reacquire borrowed row/entry positions after a size change.

A supported recoverable allocation or element-construction/copy failure shall preserve the old complete square value and dimension, destroy incomplete rows/columns, and permit a valid retry. Physical capacities and wrapper addresses need not remain unchanged. Common prerequisites shall retain 🔗 1. Square bound-matrix values and valid ownership.

RATIONALE:

Dimension growth extends the bound coordinate space while retaining all old associations and leaving new bounds unconstrained.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

void grow(dimension_type new_dimension);
VERIFICATION_CRITERIA:

Compare repeated growth histories with independent upper-left/infinity models across storage capacities; enumerate allocation and coefficient failures for row-vector relocation and both recycled/new row storage, then retry.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

10. Discarding resize establishes the requested square
UID: PPL-SPEC-000760
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Discarding resize shall admit any supported new dimension, including zero, shrinkage, equal size and growth. It shall establish the requested square with valid logical entries. It shall make no preservation promise for old entry values; callers shall initialize values they require after the call. Newly constructed logical positions shall initially be positive infinity. Storage may be recycled and clients shall reacquire borrows.

A supported recoverable failure during growth preparation shall destroy incomplete additions and retain the old complete square value and dimension so that a retry remains possible. Shrinkage shall retain the selected element types' nonthrowing destruction prerequisite.

RATIONALE:

Callers that discard prior values need a square resize without relying on incidental storage recycling.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

void resize_no_copy(dimension_type new_dimension);
VERIFICATION_CRITERIA:

Enumerate shrinking/equal/growing histories, initialize every desired new value independently before comparing it, and inject each growth allocation/element failure followed by retry.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000761
11. Reloadable ASCII records for admitted bound values
UID: PPL-SPEC-000761
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

ASCII dump shall write one dimension token followed by exactly the row-major n2 coefficient tokens, using whitespace separators and row breaks. Under compatible decimal numeric stream conventions, finite and positive-infinite values supported by the selected mathematical output/input profiles shall reload with the same mathematical matrix value. Numerical output shall retain 🔗 5. Mathematical numeric output and stream delivery status and 🔗 6. Checked numeric stream policy integration; the promise shall concern value rather than native object bytes or a zero sign bit.

Dumping shall not modify entries or ownership. Selected payloads shall lie in the loader's admitted domain of 🔗 12. Exact ASCII input, forbidden payloads and failure state for this reloadability guarantee. Stream failures/exceptions shall follow their configured channels and shall not constitute successful publication.

RATIONALE:

Persistent textual matrix records need explicit framing and numerical value fidelity distinct from ABI byte encodings.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

void ascii_dump(std::ostream& s) const;
void ascii_dump() const;
VERIFICATION_CRITERIA:

Round-trip empty, finite rational/integer/native and positive-infinite matrices, compare every independent coordinate value and confirm following-record framing without relying on object representation.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

12. Exact ASCII input, forbidden payloads and failure state
UID: PPL-SPEC-000762
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

The decoded row count shall be nonnegative and shall not exceed min(max_num_rows(), max_num_columns()). ASCII load shall return false for a greater count before resizing or requesting storage for that extent. For an admitted count, it shall read exactly its square count of row-major payloads, allocating each rectangular row only after its payload has been read. A successful load shall establish a valid square with exactly those mathematical finite or positive-infinite values, requiring exact selected-profile conversion of each token. Missing or malformed dimension/payload tokens, NaN, negative infinity and inexact payload conversions shall not yield true. Following stream content shall remain available after the completed record and permitted separating whitespace. Supported dimensions/resources and stream/numeric-policy prerequisites shall apply.

A false parse or reported exception shall not claim an old or new complete mathematical value. The target shall remain safely destructible and may be replaced by a complete valid assignment or complete supported load; callers shall not rely on uncommitted partial values. Recoverable resource exceptions shall propagate through their configured channels.

RATIONALE:

A square requires both admitted rows and admitted columns. Rejecting unsupported counts before resizing distinguishes malformed extents from resource failures for admitted extents. Exact values and complete framing distinguish a restored matrix from a partial numerical record.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

bool ascii_load(std::istream& s);
VERIFICATION_CRITERIA:

Reject the first count above the smaller row/column bound and the reserved non-dimension before payload extraction; check zero and small admitted counts, complete replacement after rejection and following-token framing. Check every truncated position, malformed dimensions and values, forbidden infinities/NaN and inexact integer/native conversions, exact records and concatenated frames; destroy failed targets or replace them through complete fresh input.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000763
13. Matrix presentation and diagnostic printing
UID: PPL-SPEC-000763
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

The human-readable stream operator shall write entries in row-major order, with spaces between entries and a row break after each row, and return the supplied stream. It shall omit the dimension header used by ASCII dump. Element text shall retain the selected mathematical output profile. An empty matrix shall produce no row text. print() shall use the matrix's configured user-level stream presentation on standard error. Neither operation shall change entries or ownership; stream failures shall retain the configured stream/error-policy behavior.

RATIONALE:

Human-readable matrix presentation and framed persistent records serve different interface purposes.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

void print() const;
namespace IO_Operators {
  template <typename T>
  std::ostream& operator<<(std::ostream& s, const DB_Matrix<T>& x);
}
VERIFICATION_CRITERIA:

Compare exact independently supplied row text for empty/singleton/small matrices, stream-return identity and captured diagnostic output, retaining original cell values.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000764
14. Matrix container and coefficient memory accounting
UID: PPL-SPEC-000764
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

External memory accounting shall include the row vector's allocated element capacity and each constructed row's known-capacity external storage/payload under 🔗 8. Row storage and live-payload memory accounting. Total memory shall add the matrix wrapper size. Known row-capacity metadata shall remain associated with the actual owned row allocations across copies, assignment, swaps, growth and discarding resize. Memory sums shall be representable and selected element memory hooks shall accurately describe their payload. Queries shall preserve values, ownership and lifetimes.

RATIONALE:

Memory estimates must include both row-owner storage and the separately allocated bound entries they manage.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

memory_size_type external_memory_in_bytes() const;
memory_size_type total_memory_in_bytes() const;
VERIFICATION_CRITERIA:

Check wrapper-size differences and independent row/payload sums at observable capacities, including empty matrices, grown/shrunk owners and swaps with different dimensions/capacities.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

PPL-SPEC-000765
15. Square-storage and row validity diagnostics
UID: PPL-SPEC-000765
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

OK() shall return false if the row-vector count disagrees with the matrix's logical column-size metadata or a row fails its size/capacity and non-NaN checks of 🔗 9. Constructed-row validity checks and diagnostic metadata. Otherwise those checks shall return true, with empty matrices admitted. Element/profile hooks and configured extra-debug capacity metadata shall retain their own semantics. The result shall describe square storage and row validity, without establishing higher-level shape closure or excluding every value that a particular matrix consumer forbids. It shall not repair invalid values or provide mathematical-value guarantees after a failed partial load or assignment.

RATIONALE:

Internal structural diagnostics must be distinguished from the stronger invariants of bounded-difference abstractions.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

bool OK() const;
VERIFICATION_CRITERIA:

Check ordinary/empty matrices, diagnostic NaN at each cell and recovery through exact replacement, and configured size/capacity checks without using corrupted storage as a normal value.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

16. Incomplete matrix cleanup and operation-specific failure guarantees
UID: PPL-SPEC-000766
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Failure during sized/copy/upward-conversion construction shall destroy every completed row/coefficient and release all resources acquired for the incomplete matrix, preserving any source matrix. Destruction shall safely release storage for the completed objects in every documented exceptional state. Assignment shall retain 🔗 5. Matrix value assignment and exceptional target state, growth and discarding resize 🔗 9. Growth preserves the old square and adds infinity coordinates and 🔗 10. Discarding resize establishes the requested square, and input 🔗 12. Exact ASCII input, forbidden payloads and failure state.

Recoverable allocation, coefficient and stream exceptions shall not become successful mathematical values. The guarantees shall require the selected element operations to retain their supported failure states and nonthrowing destruction, and shall not promise recovery from fatal GMP allocation failure or violated caller preconditions.

RATIONALE:

Container cleanup and numerical-value rollback have distinct scopes during partial construction and mutation.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

explicit DB_Matrix(dimension_type n);
DB_Matrix(const DB_Matrix& y);
template <typename U> explicit DB_Matrix(const DB_Matrix<U>& y);
~DB_Matrix();
VERIFICATION_CRITERIA:

Inject each observable row-container/backing/coefficient construction failure, count live objects and owned storage before/after cleanup, preserve sources and retry only through the documented operation-specific state guarantees.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

17. Rectilinear distance between bound-entry arrays
UID: PPL-SPEC-000767
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

With admitted workspaces and numerical prerequisites of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions, this operation shall return false for unequal matrix dimensions, leaving the result and workspaces unchanged. For equal dimensions it shall return true and assign the requested directed approximation of the rectilinear entry-array distance ∑i, jdij, where dij is the absolute finite-value difference. Equal positive-infinite entries shall contribute zero; exactly one positive infinity at any coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero. Negative infinities and NaN shall remain outside this metric domain.

The sum shall use the selected temporary/result profiles and rounding direction; a successful upward result shall bound the exact distance above and a downward result below. Matrix coordinates shall retain their values except where the supplied result overlaps an entry. Reported numerical/resource failures shall not be true results.

RATIONALE:

Distances of raw stored bound arrays need explicit coordinate, infinity and rounding conventions independent of geometric-set distance.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

template <typename Temp, typename To, typename T>
bool rectilinear_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
                     const DB_Matrix<T>& x, const DB_Matrix<T>& y,
                     Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

Compare independently computed rational rectilinear distances and directed bounds, symmetry, empty/dimension mismatch, shared/one-sided infinities and supported result overlaps.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

18. Euclidean distance between bound-entry arrays
UID: PPL-SPEC-000768
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:
With admitted workspaces and numerical prerequisites of

🔗 20. Distance scratch storage, admissible overlaps and numeric conditions, this operation shall return false for unequal matrix dimensions, leaving the result and workspaces unchanged. For equal dimensions it shall return true and assign the requested directed approximation of the Euclidean entry-array distance √(∑i, jd 2ij), where dij is the absolute finite-value difference. Equal positive-infinite entries shall contribute zero; exactly one positive infinity at any coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero. Negative infinities and NaN shall remain outside this metric domain.

The square-root of the sum of squares shall use the selected temporary/result profiles and rounding direction; a successful upward result shall bound the exact distance above and a downward result below. Matrix coordinates shall retain their values except where the supplied result overlaps an entry. Reported numerical/resource failures shall not be true results.

For rational temporaries, square-root enclosure shall retain 🔗 2. Finite rational square root at the selected irrational precision and the calling context's precision of 🔗 3. Selection and ownership of irrational rational precision.

RATIONALE:

Distances of raw stored bound arrays need explicit coordinate, infinity and rounding conventions independent of geometric-set distance.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

template <typename Temp, typename To, typename T>
bool euclidean_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
                     const DB_Matrix<T>& x, const DB_Matrix<T>& y,
                     Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

Compare independently computed rational Euclidean distances and directed bounds, symmetry, empty/dimension mismatch, shared/one-sided infinities and supported result overlaps.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

19. Maximum-coordinate distance between bound-entry arrays
UID: PPL-SPEC-000769
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

With admitted workspaces and numerical prerequisites of 🔗 20. Distance scratch storage, admissible overlaps and numeric conditions, this operation shall return false for unequal matrix dimensions, leaving the result and workspaces unchanged. For equal dimensions it shall return true and assign the requested directed approximation of the maximum-coordinate entry-array distance maxi, jdij, where dij is the absolute finite-value difference. Equal positive-infinite entries shall contribute zero; exactly one positive infinity at any coordinate shall make the distance positive infinity. Empty equal-dimensional matrices shall have distance zero. Negative infinities and NaN shall remain outside this metric domain.

The maximum shall use the selected temporary/result profiles and rounding direction; a successful upward result shall bound the exact distance above and a downward result below. Matrix coordinates shall retain their values except where the supplied result overlaps an entry. Reported numerical/resource failures shall not be true results.

RATIONALE:

Distances of raw stored bound arrays need explicit coordinate, infinity and rounding conventions independent of geometric-set distance.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

template <typename Temp, typename To, typename T>
bool l_infinity_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
                     const DB_Matrix<T>& x, const DB_Matrix<T>& y,
                     Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

Compare independently computed rational maximum-coordinate distances and directed bounds, symmetry, empty/dimension mismatch, shared/one-sided infinities and supported result overlaps.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.

20. Distance scratch storage, admissible overlaps and numeric conditions
UID: PPL-SPEC-000770
STATUS: APPROVED
COMPONENT: CORE_DATA_STRUCTURES
APPLICABILITY: IF_CPP
VERIFICATION_METHODS: Test, Analysis, Inspection
LANGUAGE: CPP
VISIBILITY: Internal
RELATIONS (Parent):
STATEMENT:

Distance calls shall require live valid square matrices, admitted finite or positive-infinite entries, a supported requested rounding direction, and temporary/result profiles supporting all conversion, subtraction, accumulation and finalization operations. Every intermediate bound shall satisfy its selected profile's representability/resource prerequisites. The three supplied mutable temporary objects shall be pairwise distinct and disjoint from matrix entry storage; their values may be overwritten.

The result output may be independent, overlap any one temporary when types permit, or overlap one live source entry when all scratch objects remain independent. Result meaning shall use the matrices' values on entry. The same matrix may be supplied for both inputs. Unequal-dimension failure shall precede scratch/result modification. Other failures shall retain the selected numerical policies' own permitted output/scratch states without a general rollback guarantee. Initialization and synchronization shall retain 🔗 3. Thread initialization, default state and finalization where required. The generic distance helper shall apply these conditions when selected with the library's rectilinear, Euclidean or maximum-coordinate distance specialization for the same temporary type.

RATIONALE:

Caller-supplied scratch storage needs actual alias and failure conditions without excluding supported result overlaps.

INTERFACE:

Internal source header: DB_Matrix_defs.hh. Names belong to Parma_Polyhedra_Library; member signatures apply to DB_Matrix<T> except the indicated nested row iterator. Dependent aliases retain their source-declared types.

template <typename Specialization, typename Temp, typename To, typename T>
bool l_m_distance_assign(Checked_Number<To, Extended_Number_Policy>& r,
                         const DB_Matrix<T>& x, const DB_Matrix<T>& y,
                         Rounding_Dir dir, Temp& tmp0, Temp& tmp1, Temp& tmp2);
VERIFICATION_CRITERIA:

Check result aliases to each scratch object and a source entry, identical input owners, unchanged result/workspaces on dimension mismatch and supported directions/profiles using independent exact-distance oracles.

SOURCE:

src/DB_Matrix_defs.hh; src/DB_Matrix_inlines.hh; src/DB_Matrix_templates.hh; src/distances_defs.hh; src/distances_inlines.hh; tests/dbmatrixspec1.cc; tests/dbmatrixgrowth1.cc; tests/dbmatrixconstrows1.cc; tests/rawmatrixmetricshistories1.cc.