18 #ifndef BINARY_INDEX_SPACE_H 19 #define BINARY_INDEX_SPACE_H 21 #ifndef SHEAF_DLL_SPEC_H 22 #include "SheafSystem/sheaf_dll_spec.h" 25 #ifndef BINARY_INDEX_H 26 #include "SheafSystem/binary_index.h" 29 #ifndef RAGGED_ARRAY_H 30 #include "SheafSystem/ragged_array.h" 36 using namespace sheaf;
64 invariance(i_size >= 0);
65 invariance(j_size >= 0);
66 invariance(size == i_size*j_size);
100 require(xi_size >= 0);
101 require(xj_size >= 0);
105 put_bounds(xi_size, xj_size);
110 ensure(i_size == xi_size);
111 ensure(j_size == xj_size);
121 void put_bounds(unary_index xi_size = 0, unary_index xj_size = 0)
129 size = i_size*j_size;
134 ensure(i_size == xi_size);
135 ensure(j_size == xj_size);
156 ensure(i_size == xl);
157 ensure(j_size == xl);
218 ((0 <= xindex.
i) && (xindex.
i < i_size) &&
219 (0 <= xindex.
j) && (xindex.
j < j_size));
224 ((0 <= xindex.
i) && (xindex.
i < i_size) &&
225 (0 <= xindex.
j) && (xindex.
j < j_size)));
241 bool result = ((0 <= xindex) && (xindex < size));
245 ensure( result == ((0 <= xindex) && (xindex < size)));
261 unary_index result = j_size*xindex.
i+ xindex.
j;
265 ensure(result == (j_size*xindex.
i+ xindex.
j));
281 unary_index result = xj + j_size*xi;
285 ensure(result == (xi*j_size + xj));
305 ensure(to_row_major_offset(result) == xindex );
324 #ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN 332 #endif // ifndef DOXYGEN_1_5_4_SKIP_UNKNOWN 336 #endif // ifndef BINARY_INDEX_SPACE_H
void put_bounds(unary_index xi_size=0, unary_index xj_size=0)
Sets i_size = xi_size and j_size = xj_size and recomputes size.
unary_index j_size
Upper bound for the second index.
bool contains(const unary_index &xindex) const
True if xindex is in this space.
binary_index_space()
Creates an instance with bound (0,0).
binary_index_space(unary_index xi_size, unary_index xj_size)
Creates an instance with bounds (xi_size, xj_size).
unary_index to_row_major_offset(const binary_index &xindex) const
Converts xindex to a unary_index using row-major ordering.
binary_index_space(unary_index xl)
Conversion from unary_index; interpreted as square.
unary_index size
Number in the space.
A bounded domain for binary_index objects.
unary_index i
The first index.
unary_index j
The second index.
Namespace for the sheaves component of the sheaf system.
binary_index from_row_major_offset(const unary_index &xindex) const
Converts xindex to a binary_index using row-major ordering.
A two index array with variable length rows.
binary_index_space operator+(const binary_index_space &xother) const
Sum.
bool contains(const binary_index &xindex) const
True if xindex is in this space.
unary_index to_row_major_offset(const unary_index xi, const unary_index xj) const
Converts (xi, xj) to a unary_index using row-major ordering.
unary_index i_size
Upper bound for the first index.
bool invariant() const
Class invariant.
Namespace for the fiber_bundles component of the sheaf system.
binary_index_space operator*(const binary_index_space &xother) const
Cartesian product.
SHEAF_DLL_SPEC std::ostream & operator<<(std::ostream &os, const binary_index &xbi)
Insert binary_index& xbi into ostream& os.