2.3. Indexes and Domains

2.3.1. The Index type

An Index is a coordinate-tuple, representing a position in a View. An Index<1> is used for Vectors, an Index<2> for Matrix, and Index<3> for Tensor.

2.3.1.1. Constructors

template <dimension_type D> Index<D>::Index();
template <> Index<1>::Index(index_type x);
template <> Index<2>::Index(index_type y,
                            index_type x);
template <> Index<3>::Index(index_type z,
                            index_type y,
                            index_type x);

Description: Create an Index<D> with the given coordinates.

2.3.1.2. Accessors

template <dimension_type D> 
index_type Index<D>::operator[](dimension_type d);

Description: Return the coordinate in the given dimension d.

2.3.2. The Domain type

A Domain is a non-empty set of non-negative indices.

2.3.2.1. Constructors

template <dimension_type D> Domain<D>::Domain();
template <> Domain<1>::Domain(index_type length);

Description: Create a Domain<1> of length length, starting at position 0, with stride=1.

template <> Domain<1>::Domain(index_type i, stride_type s, length_type len);

Description: Create a Domain<1> of length len, starting at position i, with stride s.

template <dimension_type D> Domain<D>::Domain();
template <> Domain<2>::Domain(Domain<1> &y, Domain<1> &x);
template <> Domain<3>::Domain(Domain<1> &z, Domain<1> &y, Domain<1> &x);

Description: Create 2D and 3D domains out of 2 an 3 1D domains, respectively.

2.3.2.2. Accessors

template <dimension_type D> 
Domain<1> &Domain<D>::operator[](dimension_type d);

Description: Return the 1D Domain in the given dimension.

index_type Domain<1>::first() const;

Description: Return the starting position of the domain.

stride_type Domain<1>::stride() const;

Description: Return the stride of the domain>

length_type Domain<1>::length() const;

Description: Return the length of the domain>

template <dimension_type D>
length_type Domain<D>::size() const;

Description: Return the size of the domain. For one-dimensional domains, this is the same as its length. For multi-dimensional domains, it is the product of the sizes of its (1D) constituent domains.

2.3.2.3. Arithmetic operations

template <dimension_type D> 
Domain<D> Domain<D>::operator+(index_difference_type d);

Description: Increment the start index by d.

template <dimension_type D> 
Domain<D> Domain<D>::operator-(index_difference_type d);

Description: Decrement the start index by d.

template <dimension_type D> 
Domain<D> Domain<D>::operator*(stride_scalar_type s);

Description: Multiply the domain's stride by s.

template <dimension_type D> 
Domain<D> Domain<D>::operator/(stride_scalar_type s);

Description: Divide the domain's stride by s.