Wednesday, April 26, 2017

Abstract arrays

No comments :
          An array data structure can be mathematically modeled as an abstract data structure (an abstract array) with two operations
get(AI): the data stored in the element of the array A whose indices are the integer tuple I.
set(A,I,V): the array that results by setting the value of that element to V.
These operations are required to satisfy the axioms
get(set(A,IV), I) = V
get(set(A,IV), J) = get(AJ) if I ≠ J
for any array state A, any value V, and any tuples IJ for which the operations are defined.
The first axiom means that each element behaves like a variable. The second axiom means that elements with distinct indices behave as disjoint variables, so that storing a value in one element does not affect the value of any other element.
These axioms do not place any constraints on the set of valid index tuples I, therefore this abstract model can be used for triangular matrices and other oddly-shaped arrays.

No comments :

Post a Comment