HCC
HCC is a single-source, C/C++ compiler for heterogeneous computing. It's optimized with HSA (http://www.hsafoundation.com/).
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
Concurrency::extent< N > Class Template Reference

Represents a unique position in N-dimensional space. More...

#include <amp.h>

Inheritance diagram for Concurrency::extent< N >:
Inheritance graph
Collaboration diagram for Concurrency::extent< N >:
Collaboration graph

Public Types

typedef int value_type
 The element type of extent<N>.
 

Public Member Functions

 extent ()
 Default constructor. More...
 
 extent (const extent &other)
 Copy constructor. More...
 
 extent (const int components[])
 Constructs an extent<N> with the coordinate values provided the array of int component values. More...
 
 extent (int components[])
 Constructs an extent<N> with the coordinate values provided the array of int component values. More...
 
extentoperator= (const extent &other)
 Assigns the component values of "other" to this extent<N> object. More...
 
bool contains (const index< N > &idx) const
 Tests whether the index "idx" is properly contained within this extent (with an assumed origin of zero). More...
 
unsigned int size () const
 This member function returns the total linear size of this extent<N> (in units of elements), which is computed as: extent[0] * extent[1] ... More...
 
template<int D0, int D1, int D2>
 extent (const tiled_extent< D0, D1, D2 > &other)
 
 extent (int e0)
 Constructs an extent<N> with the coordinate values provided by $e_{0..2}$. More...
 
template<typename... _Tp>
 extent (_Tp...__t)
 Constructs an extent<N> with the coordinate values provided by $e_{0..2}$. More...
 
int operator[] (unsigned int c) const
 Returns the extent component value at position c. More...
 
int & operator[] (unsigned int c)
 Returns the extent component value at position c. More...
 
template<int D0>
tiled_extent< D0 > tile () const
 Produces a tiled_extent object with the tile extents given by D0, D1, and D2. More...
 
template<int D0, int D1>
tiled_extent< D0, D1 > tile () const
 Produces a tiled_extent object with the tile extents given by D0, D1, and D2. More...
 
template<int D0, int D1, int D2>
tiled_extent< D0, D1, D2 > tile () const
 Produces a tiled_extent object with the tile extents given by D0, D1, and D2. More...
 
bool operator== (const extent &other) const
 Compares two objects of extent<N>. More...
 
bool operator!= (const extent &other) const
 Compares two objects of extent<N>. More...
 
extentoperator+= (const extent &__r)
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator-= (const extent &__r)
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator*= (const extent &__r)
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator/= (const extent &__r)
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extentoperator%= (const extent &__r)
 Adds (or subtracts) an object of type extent<N> from this extent to form a new extent. More...
 
extent operator+ (const index< N > &idx)
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extent operator- (const index< N > &idx)
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extentoperator+= (const index< N > &idx)
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extentoperator-= (const index< N > &idx)
 Adds (or subtracts) an object of type index<N> from this extent to form a new extent. More...
 
extentoperator+= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator-= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator*= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator/= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator%= (int value)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value. More...
 
extentoperator++ ()
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 
extent operator++ (int)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 
extentoperator-- ()
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 
extent operator-- (int)
 For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1. More...
 

Static Public Attributes

static const int rank = N
 A static member of extent<N> that contains the rank of this extent.
 

Friends

template<int K, typename Q >
struct Kalmar::index_helper
 
template<int K, typename Q1 , typename Q2 >
struct Kalmar::amp_helper
 

Detailed Description

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

Represents a unique position in N-dimensional space.

Template Parameters
NThe dimension to this extent applies. Special constructors are supplied for the cases where $N \in \{ 1,2,3 \}$, but N can be any integer greater than or equal to 1.

Constructor & Destructor Documentation

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

Default constructor.

The value at each dimension is initialized to zero. Thus, "extent<3> ix;" initializes the variable to the position (0,0,0).

Referenced by Concurrency::array< T, N >::operator=(), Concurrency::array_view< T, N >::operator=(), and Concurrency::array_view< const T, N >::operator=().

template<int N>
Concurrency::extent< N >::extent ( const extent< N > &  other)
inline

Copy constructor.

Constructs a new extent<N> from the supplied argument.

Parameters
otherAn object of type extent<N> from which to initialize this new extent.
template<int N>
Concurrency::extent< N >::extent ( int  e0)
inlineexplicit

Constructs an extent<N> with the coordinate values provided by $e_{0..2}$.

These are specialized constructors that are only valid when the rank of the extent $N \in \{1,2,3\}$. Invoking a specialized constructor whose argument $count \ne N$ will result in a compilation error.

Parameters
[in]e0The component values of the extent vector.
template<int N>
template<typename... _Tp>
Concurrency::extent< N >::extent ( _Tp...  __t)
inlineexplicit

Constructs an extent<N> with the coordinate values provided by $e_{0..2}$.

These are specialized constructors that are only valid when the rank of the extent $N \in \{1,2,3\}$. Invoking a specialized constructor whose argument $count \ne N$ will result in a compilation error.

Parameters
[in]e0The component values of the extent vector.
template<int N>
Concurrency::extent< N >::extent ( const int  components[])
inlineexplicit

Constructs an extent<N> with the coordinate values provided the array of int component values.

If the coordinate array length $\ne$ N, the behavior is undefined. If the array value is NULL or not a valid pointer, the behavior is undefined.

Parameters
[in]componentsAn array of N int values.
template<int N>
Concurrency::extent< N >::extent ( int  components[])
inlineexplicit

Constructs an extent<N> with the coordinate values provided the array of int component values.

If the coordinate array length $\ne$ N, the behavior is undefined. If the array value is NULL or not a valid pointer, the behavior is undefined.

Parameters
[in]componentsAn array of N int values.

Member Function Documentation

template<int N>
bool Concurrency::extent< N >::contains ( const index< N > &  idx) const
inline

Tests whether the index "idx" is properly contained within this extent (with an assumed origin of zero).

Parameters
[in]idxAn object of type index<N>
Returns
Returns true if the "idx" is contained within the space defined by this extent (with an assumed origin of zero).
template<int N>
bool Concurrency::extent< N >::operator!= ( const extent< N > &  other) const
inline

Compares two objects of extent<N>.

The expression leftExt $\oplus$ rightExt is true if leftExt[i] $\oplus$ rightExt[i] for every i from 0 to N-1.

Parameters
[in]otherThe right-hand extent<N> to be compared.
template<int N>
extent& Concurrency::extent< N >::operator%= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator%= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent& Concurrency::extent< N >::operator*= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator*= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent Concurrency::extent< N >::operator+ ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator++ ( )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent Concurrency::extent< N >::operator++ ( int  )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent& Concurrency::extent< N >::operator+= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator+= ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator+= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent Concurrency::extent< N >::operator- ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator-- ( )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent Concurrency::extent< N >::operator-- ( int  )
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ 1.

For prefix increment and decrement, the return value is "*this". Otherwise a new extent<N> is returned.

template<int N>
extent& Concurrency::extent< N >::operator-= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator-= ( const index< N > &  idx)
inline

Adds (or subtracts) an object of type index<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ idx[i]

Parameters
[in]idxThe right-hand index<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator-= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent& Concurrency::extent< N >::operator/= ( const extent< N > &  __r)
inline

Adds (or subtracts) an object of type extent<N> from this extent to form a new extent.

The result extent<N> is such that for a given operator $\oplus$, result[i] = this[i] $\oplus$ ext[i]

Parameters
[in]extThe right-hand extent<N> to be added or subtracted.
template<int N>
extent& Concurrency::extent< N >::operator/= ( int  value)
inline

For a given operator $\oplus$, produces the same effect as (*this) = (*this) $\oplus$ value.

The return value is "*this".

Parameters
[in]valueThe right-hand int of the arithmetic operation.
template<int N>
extent& Concurrency::extent< N >::operator= ( const extent< N > &  other)
inline

Assigns the component values of "other" to this extent<N> object.

Parameters
[in]otherAn object of type extent<N> from which to copy into this extent.
Returns
Returns *this.
template<int N>
bool Concurrency::extent< N >::operator== ( const extent< N > &  other) const
inline

Compares two objects of extent<N>.

The expression leftExt $\oplus$ rightExt is true if leftExt[i] $\oplus$ rightExt[i] for every i from 0 to N-1.

Parameters
[in]otherThe right-hand extent<N> to be compared.
template<int N>
int Concurrency::extent< N >::operator[] ( unsigned int  c) const
inline

Returns the extent component value at position c.

Parameters
[in]cThe dimension axis whose coordinate is to be accessed.
Returns
A the component value at position c.
template<int N>
int& Concurrency::extent< N >::operator[] ( unsigned int  c)
inline

Returns the extent component value at position c.

Parameters
[in]cThe dimension axis whose coordinate is to be accessed.
Returns
A the component value at position c.
template<int N>
unsigned int Concurrency::extent< N >::size ( ) const
inline
template<int N>
template<int D0>
tiled_extent<D0> Concurrency::extent< N >::tile ( ) const
inline

Produces a tiled_extent object with the tile extents given by D0, D1, and D2.

tile<D0,D1,D2>() is only supported on extent<3>. It will produce a compile-time error if used on an extent where N $\ne$ 3. tile<D0,D1>() is only supported on extent<2>. It will produce a compile-time error if used on an extent where N $\ne$ 2. tile<D0>() is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 1.

template<int N>
template<int D0, int D1>
tiled_extent<D0, D1> Concurrency::extent< N >::tile ( ) const
inline

Produces a tiled_extent object with the tile extents given by D0, D1, and D2.

tile<D0,D1,D2>() is only supported on extent<3>. It will produce a compile-time error if used on an extent where N $\ne$ 3. tile<D0,D1>() is only supported on extent<2>. It will produce a compile-time error if used on an extent where N $\ne$ 2. tile<D0>() is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 1.

template<int N>
template<int D0, int D1, int D2>
tiled_extent<D0, D1, D2> Concurrency::extent< N >::tile ( ) const
inline

Produces a tiled_extent object with the tile extents given by D0, D1, and D2.

tile<D0,D1,D2>() is only supported on extent<3>. It will produce a compile-time error if used on an extent where N $\ne$ 3. tile<D0,D1>() is only supported on extent<2>. It will produce a compile-time error if used on an extent where N $\ne$ 2. tile<D0>() is only supported on extent<1>. It will produce a compile-time error if used on an extent where N $\ne$ 1.


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