A dense container of dimensionality D
with elements of type T
.
More...
Public Types | |
typedef T | element_type |
Public Member Functions | |
dense () | |
Default constructor. Constructs an empty dense container. | |
dense (const dense &src) | |
Copy constructor. | |
dense (const usize &length) | |
Constructs a 1D dense container of the specified size. | |
dense (const usize &width, const usize &height) | |
Constructs a 2D dense container of the specified size. | |
dense (const usize &width, const usize &height, const usize &depth) | |
Constructs a 3D dense container of the specified size. | |
dense (const array< usize, D > &size) | |
Constructs a dense container with size specified as an arbb::array of arbb::usize values. | |
template<typename U > | |
dense (const dense< U, D > &src) | |
Conversion constructor. | |
T | operator[] (const usize &index) const |
Returns the element at the provided index for one-dimensional dense containers. | |
element | operator[] (const usize &index) |
Returns a reference to the element at the provided index for one-dimensional dense containers. | |
T | operator() (const usize &col, const usize &row) const |
Returns the element at the provided index for two-dimensional dense containers. | |
element | operator() (const usize &col, const usize &row) |
Returns a reference to the element at the provided index for two-dimensional dense containers. | |
T | operator() (const usize &col, const usize &row, const usize &page) const |
Returns the element at the provided index for three-dimensional dense containers. | |
element | operator() (const usize &col, const usize &row, const usize &page) |
Returns a reference to the element at the provided index for three-dimensional dense containers. | |
dense< T, 1 > | operator[] (const dense< usize, 1 > &indices) const |
Returns a dense container R of the same size as indices , such that R[i] == (*this)[indices[i]] . | |
dense< T, 2 > | operator[] (const dense< array< usize, 2 >, 2 > &indices) const |
Returns a dense container R of the same size as indices , such that R[i] == (*this)[indices[i]] . | |
dense< T, 3 > | operator[] (const dense< array< usize, 3 >, 3 > &indices) const |
Returns a dense container R of the same size as indices , such that R[i] == (*this)[indices[i]] . | |
dense< T, 1 > | operator[] (const dense< boolean, 1 > &mask) const |
Selects the elements of the dense container that correspond to the true in mask and returns them as a dense container in the order they appeared in the dense container. | |
dense & | operator= (const dense &src) |
Assignment operator. | |
dense< T, 1 > | flatten () const |
Returns a copy of the container data as a 1D dense container. | |
usize | length () const |
Returns the number of elements in the container. | |
usize | num_cols () const |
Returns the number of columns in (the width of) the container. | |
usize | num_rows () const |
Returns the number of rows in (the height of) the container. | |
usize | num_pages () const |
Returns the number of pages in (the depth of) the container. | |
array< usize, D > | size () const |
Returns an array containing the number of columns, rows, and pages (up to the appropriate dimensionality) respectively in the container. | |
dense< T, 1 > | row (const usize &index) const |
Returns the row at index from a 2D container. | |
dense< T, 1 > | row (const usize &row_index, const usize &page_index) const |
Returns the row at row_index from the page at page_index from a 3D container. | |
dense< T, 1 > | col (const usize &index) const |
Returns the column at index from a 2D container. | |
dense< T, 1 > | col (const usize &column_index, const usize &page_index) const |
Returns the column at column_index from the page at page_index from a 3D container. | |
dense< T, 2 > | page (const usize &index) const |
Returns the page at index from a 3D container. | |
dense< T, 1 > | dim3 (const usize &column_index, const usize &row_index) const |
Returns the pillar from the columns at column_index and the rows at row_index from a 3D container. | |
range< T > | read_write_range () |
Returns a range that can be both written to and read from. | |
const_range< T > | read_only_range () const |
Returns a range that can only be read from. | |
range< T > | write_only_range () |
Returns a range that can only be written to. | |
template<typename S , std::size_t N> | |
detail::enable_if < detail::is_scalar< S > ::value, dense< S, D > >::type | get () const |
Returns the dense container of scalar values corresponding to the values at index N in the element structure. | |
template<std::size_t N, arbb_scalar_type_t S> | |
void | set (const dense< scalar< S >, D > &val) |
Assigns val to the dense container of scalar values corresponding to the values at index N in the element structure. | |
template<typename U > | |
detail::zipped_dense< D > | zip (const dense< U, D > &other) const |
Returns a zipped sequence, holding this container followed by the other parameter. | |
Static Public Member Functions | |
static dense< T, D > | parse (const char *data) |
A dense container of dimensionality D
with elements of type T
.
Definition at line 51 of file dense.hpp.
typedef T arbb::dense< T, D >::element_type |
arbb::dense< T, D >::dense | ( | ) |
Default constructor. Constructs an empty dense container.
arbb::dense< T, D >::dense | ( | const dense< T, D > & | src | ) |
Copy constructor.
Constructs a dense container with the same shape and values as src
.
arbb::dense< T, D >::dense | ( | const usize & | length | ) | [explicit] |
Constructs a 1D dense container of the specified size.
The elements of the constructed container have unspecified value. This constructor can only be called when D == 1
.
arbb::dense< T, D >::dense | ( | const usize & | width, | |
const usize & | height | |||
) |
Constructs a 2D dense container of the specified size.
The elements of the constructed container have unspecified value. This constructor can only be called when D == 2
.
arbb::dense< T, D >::dense | ( | const usize & | width, | |
const usize & | height, | |||
const usize & | depth | |||
) |
Constructs a 3D dense container of the specified size.
The elements of the constructed container have unspecified value. This constructor can only be called when D == 3
.
arbb::dense< T, D >::dense | ( | const array< usize, D > & | size | ) | [explicit] |
Constructs a dense container with size
specified as an arbb::array of arbb::usize values.
The number of elements in the array must equal D
, which is the dimensionality of the container type being constructed. For i
between 0
and D - 1
, size[i]
contains the length along dimension i
. The elements of the constructed container have unspecified value.
arbb::dense< T, D >::dense | ( | const dense< U, D > & | src | ) | [inline] |
Conversion constructor.
Constructs a dense container of the same size as src
, with elements equal to those in src
at corresponding indices converted to the destination type using a converting cast.
static dense<T, D> arbb::dense< T, D >::parse | ( | const char * | data | ) | [static] |
T arbb::dense< T, D >::operator[] | ( | const usize & | index | ) | const |
Returns the element at the provided index
for one-dimensional dense containers.
This function does not instantiate when D != 1
.
element arbb::dense< T, D >::operator[] | ( | const usize & | index | ) |
Returns a reference to the element at the provided index
for one-dimensional dense containers.
This function does not instantiate when D != 1
. The returned type can be converted to an instance of type T
, and assigned to from an instance of type T
. When assigned to, the container from which the element reference was returned is modified accordingly.
T arbb::dense< T, D >::operator() | ( | const usize & | col, | |
const usize & | row | |||
) | const |
Returns the element at the provided index for two-dimensional dense containers.
This function does not instantiate when D != 2
.
element arbb::dense< T, D >::operator() | ( | const usize & | col, | |
const usize & | row | |||
) |
Returns a reference to the element at the provided index for two-dimensional dense containers.
This function does not instantiate when D != 2
. The returned type can be converted to an instance of type T
, and assigned to from an instance of type T
. When assigned to, the container from which the element reference was returned is modified accordingly.
T arbb::dense< T, D >::operator() | ( | const usize & | col, | |
const usize & | row, | |||
const usize & | page | |||
) | const |
Returns the element at the provided index for three-dimensional dense containers.
This function does not instantiate when D != 3
.
element arbb::dense< T, D >::operator() | ( | const usize & | col, | |
const usize & | row, | |||
const usize & | page | |||
) |
Returns a reference to the element at the provided index for three-dimensional dense containers.
This function does not instantiate when D != 3
. The returned type can be converted to an instance of type T
, and assigned to from an instance of type T
. When assigned to, the container from which the element reference was returned is modified accordingly.
dense<T, 1> arbb::dense< T, D >::operator[] | ( | const dense< usize, 1 > & | indices | ) | const |
Returns a dense container R
of the same size as indices
, such that R[i] == (*this)[indices[i]]
.
dense<T, 2> arbb::dense< T, D >::operator[] | ( | const dense< array< usize, 2 >, 2 > & | indices | ) | const |
Returns a dense container R
of the same size as indices
, such that R[i] == (*this)[indices[i]]
.
dense<T, 3> arbb::dense< T, D >::operator[] | ( | const dense< array< usize, 3 >, 3 > & | indices | ) | const |
Returns a dense container R
of the same size as indices
, such that R[i] == (*this)[indices[i]]
.
dense<T, 1> arbb::dense< T, D >::operator[] | ( | const dense< boolean, 1 > & | mask | ) | const |
Selects the elements of the dense container that correspond to the true
in mask
and returns them as a dense container in the order they appeared in the dense container.
The size of the returned container equals the number of true
elements in mask
. The size of mask
must be the same as the size of the source container.
dense& arbb::dense< T, D >::operator= | ( | const dense< T, D > & | src | ) |
Assignment operator.
If the destination of the assignment is bound (see Container Bindings), the size of src
must match the size of the destination. In this case, the operator copies each element from src
to the element of the destination with the corresponding index.
If the destination is not bound, the relative sizes of the containers do not matter. In this case, the operator changes the destination to be a copy of src
.
exception | if the destination is bound and the source size does not match the destination size. |
dense<T, 1> arbb::dense< T, D >::flatten | ( | ) | const |
Returns a copy of the container data as a 1D dense container.
usize arbb::dense< T, D >::length | ( | ) | const |
Returns the number of elements in the container.
usize arbb::dense< T, D >::num_cols | ( | ) | const |
Returns the number of columns in (the width of) the container.
usize arbb::dense< T, D >::num_rows | ( | ) | const |
Returns the number of rows in (the height of) the container.
For one-dimensional containers, always returns 1.
usize arbb::dense< T, D >::num_pages | ( | ) | const |
Returns the number of pages in (the depth of) the container.
For one-dimensional and two-dimensional containers, always returns 1.
array<usize, D> arbb::dense< T, D >::size | ( | ) | const |
Returns an array containing the number of columns, rows, and pages (up to the appropriate dimensionality) respectively in the container.
dense<T, 1> arbb::dense< T, D >::row | ( | const usize & | index | ) | const |
Returns the row at index
from a 2D container.
If D != 2
this function does not instantiate.
dense<T, 1> arbb::dense< T, D >::row | ( | const usize & | row_index, | |
const usize & | page_index | |||
) | const |
Returns the row at row_index
from the page at page_index
from a 3D container.
If D != 3
this function does not instantiate.
dense<T, 1> arbb::dense< T, D >::col | ( | const usize & | index | ) | const |
Returns the column at index
from a 2D container.
If D != 2
this function will does instantiate.
dense<T, 1> arbb::dense< T, D >::col | ( | const usize & | column_index, | |
const usize & | page_index | |||
) | const |
Returns the column at column_index
from the page at page_index
from a 3D container.
If D != 3
this function does not instantiate.
dense<T, 2> arbb::dense< T, D >::page | ( | const usize & | index | ) | const |
Returns the page at index
from a 3D container.
If D != 3
this function does not instantiate.
dense<T, 1> arbb::dense< T, D >::dim3 | ( | const usize & | column_index, | |
const usize & | row_index | |||
) | const |
Returns the pillar from the columns at column_index
and the rows at row_index
from a 3D container.
If D != 3
this function does not instantiate.
range<T> arbb::dense< T, D >::read_write_range | ( | ) |
Returns a range that can be both written to and read from.
const_range<T> arbb::dense< T, D >::read_only_range | ( | ) | const |
Returns a range that can only be read from.
range<T> arbb::dense< T, D >::write_only_range | ( | ) |
Returns a range that can only be written to.
detail::enable_if<detail::is_scalar<S>::value, dense<S, D> >::type arbb::dense< T, D >::get | ( | ) | const [inline] |
Returns the dense container of scalar values corresponding to the values at index N
in the element structure.
If the dense container on which get() is called contains scalar elements, this function can only be called with N == 0
.
arbb::exception | if N is greater than or equal to the number of scalars in the element type. | |
arbb::exception | if the scalar type at index N in the element type does not match S . |
void arbb::dense< T, D >::set | ( | const dense< scalar< S >, D > & | val | ) | [inline] |
Assigns val
to the dense container of scalar values corresponding to the values at index N
in the element structure.
If the dense container on which set() is called contains scalar elements, this function can only be called with N == 0
.
If the number of elements in any two scalar containers vary after the set() call, attempts to perform operations on the container as a whole yields undefined behavior.
arbb::exception | if N is greater than or equal to the number of scalars in the element type. | |
arbb::exception | if the scalar type at index N in the element type does not match arbb::scalar<S> . |
detail::zipped_dense<D> arbb::dense< T, D >::zip | ( | const dense< U, D > & | other | ) | const [inline] |
Returns a zipped sequence, holding this container followed by the other
parameter.
You can further zip these containers using chains of zip() calls. A zipped sequence of containers can then be assigned to a container of user-defined element type, as long as the sequence of element types matches.
For example:
struct foo { f32 a; i32 b; u8 c; }; void bar() { arbb::dense<f32> a = ...; arbb::dense<i32> b = ...; arbb::dense<u8> c = ...; arbb::dense<foo> f = a.zip(b).zip(c); }
Copyright © 2010, Intel Corporation. All rights reserved.