STLdoc
STLdocumentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends | List of all members
Concurrency::extent< _Rank > Class Template Reference

The extent<N> type represents an N-dimensional vector of int which specifies the bounds of an N-dimensional space with an origin of 0. The values in the coordinate vector are ordered from most-significant to least-significant. Thus, in 2-dimensional space, the extent vector (5,3) represents a space with 5 rows and 3 columns. More...

#include <amp.h>

Public Types

typedef int value_type
 

Public Member Functions

 _CPP_AMP_VERIFY_RANK (_Rank, extent)
 
 extent () __GPU
 Default constructor. The value at each dimension is initialized to zero. More...
 
 extent (const extent< _Rank > &_Other) __GPU
 Copy constructor. Constructs a new extent from the supplied argument _Other. More...
 
 extent (int _I) __GPU
 Constructor for extent<1>. More...
 
 extent (int _I0, int _I1) __GPU
 Constructor for extent<2> More...
 
 extent (int _I0, int _I1, int _I2) __GPU
 Constructor for extent<3> More...
 
 extent (const int _Array[_Rank]) __GPU
 Constructs an extent with the coordinate values provided the array of int component values. If the coordinate array length is not N, the behavior is undefined. More...
 
extent< _Rank > & operator= (const extent< _Rank > &_Other) __GPU
 copy-assignment operator More...
 
int operator[] (unsigned int _Index) const __GPU
 Index operator. More...
 
intoperator[] (unsigned int _Index) __GPU
 Index operators. More...
 
unsigned int size () const __GPU
 Returns the total linear size of this extent (in units of elements). More...
 
bool contains (const index< rank > &_Index) const __GPU
 Tests whether the index "_Index" is properly contained within this extent. More...
 
template<int _Dim0>
tiled_extent< _Dim0 > tile () const __GPU
 Produces a tiled_extent object with the tile extents given by _Dim0. More...
 
template<int _Dim0, int _Dim1>
tiled_extent< _Dim0, _Dim1 > tile () const __GPU
 Produces a tiled_extent object with the tile extents given by _Dim0, _Dim1 More...
 
template<int _Dim0, int _Dim1, int _Dim2>
tiled_extent< _Dim0, _Dim1, _Dim2 > tile () const __GPU
 Produces a tiled_extent object with the tile extents given by _Dim0, _Dim1, _Dim2. More...
 
extent< _Rank > operator+ (const index< _Rank > &_Rhs) __GPU
 Element-wise addition of this extent with an index. More...
 
extent< _Rank > operator- (const index< _Rank > &_Rhs) __GPU
 Element-wise subtraction of this extent with an index. More...
 
extent< _Rank > & operator+= (const extent< _Rank > &_Rhs) __GPU
 Element-wise addition of this extent with another extent. More...
 
extent< _Rank > & operator-= (const extent< _Rank > &_Rhs) __GPU
 Element-wise subtraction of this extent with another extent. More...
 
extent< _Rank > & operator+= (const index< _Rank > &_Rhs) __GPU
 Element-wise addition of this extent with an index. More...
 
extent< _Rank > & operator-= (const index< _Rank > &_Rhs) __GPU
 Element-wise subtraction of this extent with an index. More...
 
extent< _Rank > & operator+= (int _Rhs) __GPU
 Adds an integer value to each element of this extent. More...
 
extent< _Rank > & operator-= (int _Rhs) __GPU
 Subtracts an integer value from each element of this extent. More...
 
extent< _Rank > & operator*= (int _Rhs) __GPU
 Multiplies an integer value to each element of this extent. More...
 
extent< _Rank > & operator/= (int _Rhs) __GPU
 Divides an integer value into each element of this extent. More...
 
extent< _Rank > & operator%= (int _Rhs) __GPU
 Modulus an integer value from each element of this extent. More...
 
extent< _Rank > & operator++ () __GPU
 Pre-increments each element of this extent. More...
 
extent< _Rank > operator++ (int) __GPU
 Post-increments each element of this extent. More...
 
extent< _Rank > & operator-- () __GPU
 Pre-decrements each element of this extent. More...
 
extent< _Rank > operator-- (int) __GPU
 Post-decrements each element of this extent. More...
 
index< _Rank > _map_index (const index< _Rank > &_Index) const __GPU
 

Static Public Attributes

static const int rank = _Rank
 

Private Member Functions

 extent (details::_eInitializeState) __GPU
 Constructor. More...
 

Private Attributes

int _M_base [_Rank]
 

Friends

template<typename _Value_type , int _Rank>
class array
 
template<int _Rank, int _Element_size>
class details::_Array_view_shape
 
template<int _Rank, int _Element_size>
class details::_Array_view_base
 
template<class _Tuple_type >
_Tuple_type details::_Create_uninitialized_tuple () __GPU
 

Detailed Description

template<int _Rank>
class Concurrency::extent< _Rank >

The extent<N> type represents an N-dimensional vector of int which specifies the bounds of an N-dimensional space with an origin of 0. The values in the coordinate vector are ordered from most-significant to least-significant. Thus, in 2-dimensional space, the extent vector (5,3) represents a space with 5 rows and 3 columns.

All components of an extent must be non-negative. E.g. extent<3> domain(2, 3, 4); represents all points index<3> _Index; such that 0 <= _Index[0] < 2; 0 <= _Index[1] < 3; 0 <= _Index[2] < 4;

Parameters
_RankThe _Rank or the dimensionality of the index space.

Member Typedef Documentation

template<int _Rank>
typedef int Concurrency::extent< _Rank >::value_type

Constructor & Destructor Documentation

template<int _Rank>
Concurrency::extent< _Rank >::extent ( )
inline

Default constructor. The value at each dimension is initialized to zero.

405  {
406  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAssign>::func(*this, 0);
407  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::extent< _Rank >::extent ( const extent< _Rank > &  _Other)
inline

Copy constructor. Constructs a new extent from the supplied argument _Other.

Parameters
_OtherThe extent instance to be copied from .
416  {
417  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAssign>::func(*this, _Other);
418  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::extent< _Rank >::extent ( int  _I)
inlineexplicit

Constructor for extent<1>.

Parameters
_IThe value for initialization
427  {
428  static_assert(_Rank == 1, "This constructor can only be used to construct an extent<1> object.");
429  _M_base[0] = _I;
430  }
int _M_base[_Rank]
Definition: amp.h:806
template<int _Rank>
Concurrency::extent< _Rank >::extent ( int  _I0,
int  _I1 
)
inline

Constructor for extent<2>

Parameters
_I0The extent value for dimension 0
_I1The extent value for dimension 1
442  {
443  static_assert(_Rank == 2, "This constructor can only be used to construct an extent<2> object.");
444  _M_base[0] = _I0;
445  _M_base[1] = _I1;
446  }
int _M_base[_Rank]
Definition: amp.h:806
template<int _Rank>
Concurrency::extent< _Rank >::extent ( int  _I0,
int  _I1,
int  _I2 
)
inline

Constructor for extent<3>

Parameters
_I0The extent value for dimension 0
_I1The extent value for dimension 1
_I2The extent value for dimension 2
461  {
462  static_assert(_Rank == 3, "This constructor can only be used to construct an extent<3> object.");
463  _M_base[0] = _I0;
464  _M_base[1] = _I1;
465  _M_base[2] = _I2;
466  }
int _M_base[_Rank]
Definition: amp.h:806
template<int _Rank>
Concurrency::extent< _Rank >::extent ( const int  _Array[_Rank])
inlineexplicit

Constructs an extent with the coordinate values provided the array of int component values. If the coordinate array length is not N, the behavior is undefined.

Parameters
_ArrayA single-dimensional array with _Rank elements.
477  {
478  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAssign>::func(*this, _Array);
479  }
Definition: xxamp.h:233
template<int _Rank>
Concurrency::extent< _Rank >::extent ( details::_eInitializeState  )
inlineprivate

Constructor.

Indicates that no initialization is necessary.

803 {}

Member Function Documentation

template<int _Rank>
Concurrency::extent< _Rank >::_CPP_AMP_VERIFY_RANK ( _Rank  ,
extent< _Rank >   
)
template<int _Rank>
index<_Rank> Concurrency::extent< _Rank >::_map_index ( const index< _Rank > &  _Index) const
inline
789  {
790  return _Index;
791  }
template<int _Rank>
bool Concurrency::extent< _Rank >::contains ( const index< rank > &  _Index) const
inline

Tests whether the index "_Index" is properly contained within this extent.

530  {
531  return details::_contains<extent<rank>, index<rank>, rank>::func(*this, _Index);
532  }
static const int rank
Definition: amp.h:397
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator%= ( int  _Rhs)
inline

Modulus an integer value from each element of this extent.

Parameters
_RhsThe integer value to modulo this extent
Returns
A reference to this extent.
731  {
732  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opModEq>::func(*this, _Rhs);
733  return *this;
734  }
Definition: xxamp.h:238
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator*= ( int  _Rhs)
inline

Multiplies an integer value to each element of this extent.

Parameters
_RhsThe integer value to multiply into this extent
Returns
A reference to this extent.
701  {
702  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opMulEq>::func(*this, _Rhs);
703  return *this;
704  }
Definition: xxamp.h:236
template<int _Rank>
extent<_Rank> Concurrency::extent< _Rank >::operator+ ( const index< _Rank > &  _Rhs)
inline

Element-wise addition of this extent with an index.

Parameters
_RhsThe index to add to this extent
Returns
A new extent with the result of the computation.
579  {
580  extent<_Rank> new_extent(details::_do_not_initialize);
581  details::_arithmetic_op_loop_helper<extent<_Rank>, details::opAdd>::func(new_extent, *this, _Rhs);
582  return new_extent;
583  }
Definition: xxamp.h:240
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator++ ( )
inline

Pre-increments each element of this extent.

Returns
A reference to this extent.
743  {
744  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAddEq>::func(*this, 1);
745  return *this;
746  }
Definition: xxamp.h:234
template<int _Rank>
extent<_Rank> Concurrency::extent< _Rank >::operator++ ( int  )
inline

Post-increments each element of this extent.

Returns
The value of the unincremented extent.
755  {
756  extent<_Rank> old_extent(*this);
757  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAddEq>::func(*this, 1);
758  return old_extent;
759  }
Definition: xxamp.h:234
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator+= ( const extent< _Rank > &  _Rhs)
inline

Element-wise addition of this extent with another extent.

Parameters
_RhsThe extent to add
Returns
A reference to this extent.
611  {
612  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAddEq>::func(*this, _Rhs);
613  return *this;
614  }
Definition: xxamp.h:234
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator+= ( const index< _Rank > &  _Rhs)
inline

Element-wise addition of this extent with an index.

Parameters
_RhsThe index to add
Returns
A reference to this extent.
641  {
642  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAddEq>::func(*this, _Rhs);
643  return *this;
644  }
Definition: xxamp.h:234
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator+= ( int  _Rhs)
inline

Adds an integer value to each element of this extent.

Parameters
_RhsThe integer value to add to this extent
Returns
A reference to this extent.
671  {
672  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAddEq>::func(*this, _Rhs);
673  return *this;
674  }
Definition: xxamp.h:234
template<int _Rank>
extent<_Rank> Concurrency::extent< _Rank >::operator- ( const index< _Rank > &  _Rhs)
inline

Element-wise subtraction of this extent with an index.

Parameters
_RhsThe index to subtract from this extent
Returns
A new extent with the result of the computation.
595  {
596  extent<_Rank> new_extent(details::_do_not_initialize);
597  details::_arithmetic_op_loop_helper<extent<_Rank>, details::opSub>::func(new_extent, *this, _Rhs);
598  return new_extent;
599  }
Definition: xxamp.h:241
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator-- ( )
inline

Pre-decrements each element of this extent.

Returns
A reference to this extent.
768  {
769  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opSubEq>::func(*this, 1);
770  return *this;
771  }
Definition: xxamp.h:235
template<int _Rank>
extent<_Rank> Concurrency::extent< _Rank >::operator-- ( int  )
inline

Post-decrements each element of this extent.

Returns
The value of the undecremented extent.
780  {
781  extent<_Rank> old_extent(*this);
782  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opSubEq>::func(*this, 1);
783  return old_extent;
784  }
Definition: xxamp.h:235
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator-= ( const extent< _Rank > &  _Rhs)
inline

Element-wise subtraction of this extent with another extent.

Parameters
_RhsThe extent to subtract
Returns
A reference to this extent.
626  {
627  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opSubEq>::func(*this, _Rhs);
628  return *this;
629  }
Definition: xxamp.h:235
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator-= ( const index< _Rank > &  _Rhs)
inline

Element-wise subtraction of this extent with an index.

Parameters
_RhsThe index to subtract
Returns
A reference to this extent.
656  {
657  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opSubEq>::func(*this, _Rhs);
658  return *this;
659  }
Definition: xxamp.h:235
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator-= ( int  _Rhs)
inline

Subtracts an integer value from each element of this extent.

Parameters
_RhsThe integer value to subtract from this extent
Returns
A reference to this extent.
686  {
687  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opSubEq>::func(*this, _Rhs);
688  return *this;
689  }
Definition: xxamp.h:235
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator/= ( int  _Rhs)
inline

Divides an integer value into each element of this extent.

Parameters
_RhsThe integer value to divide into this extent
Returns
A reference to this extent.
716  {
717  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opDivEq>::func(*this, _Rhs);
718  return *this;
719  }
Definition: xxamp.h:237
template<int _Rank>
extent<_Rank>& Concurrency::extent< _Rank >::operator= ( const extent< _Rank > &  _Other)
inline

copy-assignment operator

485  {
486  details::_compound_assign_op_loop_helper<extent<_Rank>, details::opAssign>::func(*this, _Other);
487  return *this;
488  }
Definition: xxamp.h:233
template<int _Rank>
int Concurrency::extent< _Rank >::operator[] ( unsigned int  _Index) const
inline

Index operator.

Parameters
_IndexAn integral value between 0 and _Rank-1.
Returns
The corresponding value stored at _Index.
500  {
501  return _M_base[_Index];
502  }
int _M_base[_Rank]
Definition: amp.h:806
template<int _Rank>
int& Concurrency::extent< _Rank >::operator[] ( unsigned int  _Index)
inline

Index operators.

Parameters
_IndexAn integral value between 0 and _Rank-1.
Returns
A reference to the value stored at _Index.
514  {
515  return _M_base[_Index];
516  }
int _M_base[_Rank]
Definition: amp.h:806
template<int _Rank>
unsigned int Concurrency::extent< _Rank >::size ( ) const
inline

Returns the total linear size of this extent (in units of elements).

522  {
523  return static_cast<unsigned int>(_product_helper<extent<_Rank>>::func(_M_base));
524  }
int _M_base[_Rank]
Definition: amp.h:806
template<int _Rank>
template<int _Dim0>
tiled_extent<_Dim0> Concurrency::extent< _Rank >::tile ( ) const
inline

Produces a tiled_extent object with the tile extents given by _Dim0.

538  {
539  static_assert(rank == 1, "One-dimensional tile() method only available on extent<1>");
540  static_assert(_Dim0>0, "All tile dimensions must be positive");
541 
542  return tiled_extent<_Dim0>(*this);
543  }
static const int rank
Definition: amp.h:397
template<int _Rank>
template<int _Dim0, int _Dim1>
tiled_extent<_Dim0, _Dim1> Concurrency::extent< _Rank >::tile ( ) const
inline

Produces a tiled_extent object with the tile extents given by _Dim0, _Dim1

549  {
550  static_assert(rank == 2, "Two-dimensional tile() method only available on extent<2>");
551  static_assert(_Dim0>0 && _Dim1>0, "All tile dimensions must be positive");
552 
553  return tiled_extent<_Dim0, _Dim1>(*this);
554  }
static const int rank
Definition: amp.h:397
template<int _Rank>
template<int _Dim0, int _Dim1, int _Dim2>
tiled_extent<_Dim0, _Dim1, _Dim2> Concurrency::extent< _Rank >::tile ( ) const
inline

Produces a tiled_extent object with the tile extents given by _Dim0, _Dim1, _Dim2.

560  {
561  static_assert(rank == 3, "Three-dimensional tile() method only available on extent<3>");
562  static_assert(_Dim0>0 && _Dim1>0 && _Dim2>0, "All tile dimensions must be positive");
563 
564  return tiled_extent<_Dim0, _Dim1, _Dim2>(*this);
565  }
static const int rank
Definition: amp.h:397

Friends And Related Function Documentation

template<int _Rank>
template<typename _Value_type , int _Rank>
friend class array
friend
template<int _Rank>
template<int _Rank, int _Element_size>
friend class details::_Array_view_base
friend
template<int _Rank>
template<int _Rank, int _Element_size>
friend class details::_Array_view_shape
friend
template<int _Rank>
template<class _Tuple_type >
_Tuple_type details::_Create_uninitialized_tuple ( )
friend

Member Data Documentation

template<int _Rank>
int Concurrency::extent< _Rank >::_M_base[_Rank]
private
template<int _Rank>
const int Concurrency::extent< _Rank >::rank = _Rank
static

The documentation for this class was generated from the following file: