Gets a reference to a set of elements. More...

Functions

array::array_proxy operator() (const index &s0)
 This operator returns a reference of the original array at a given coordinate. More...
 
const array::array_proxy operator() (const index &s0) const
 This operator returns a reference of the original array at a given coordinate. More...
 
array::array_proxy operator() (const index &s0, const index &s1, const index &s2=span, const index &s3=span)
 This operator returns a reference of the original array at a given coordinate. More...
 
const array::array_proxy operator() (const index &s0, const index &s1, const index &s2=span, const index &s3=span) const
 This operator returns a reference of the original array at a given coordinate. More...
 

Detailed Description

Gets a reference to a set of elements.

array A = array(seq(1,9), 3, 3);
af_print(A(0)); // first element
af_print(A(0,1)); // first row, second column
af_print(A(end)); // last element
af_print(A(-1)); // also last element
af_print(A(end-1)); // second-to-last element
af_print(A(1,span)); // second row
af_print(A.row(end)); // last row
af_print(A.cols(1,end)); // all but first column
float b_host[] = {0,1,2,3,4,5,6,7,8,9};
array b(10, 1, b_host);
af_print(b(seq(3)));
af_print(b(seq(1,7)));
af_print(b(seq(1,7,2)));
af_print(b(seq(0,end,2)));

This operator returns a reference of the original array at a given coordinate. You can pass af::seq, af::array, or an int as it's parameters. These references can be used for assignment or returning references to af::array objects.


Function Documentation

array::array_proxy operator() ( const index s0)

This operator returns a reference of the original array at a given coordinate.

You can pass af::seq, af::array, or an int as it's parameters. These references can be used for assignment or returning references to af::array objects.

If the af::array is a multi-dimensional array then this coordinate will treated as the data as a linear array.

Parameters
[in]s0is sequence of linear indices
Returns
A reference to the array at the given index
const array::array_proxy operator() ( const index s0) const

This operator returns a reference of the original array at a given coordinate.

You can pass af::seq, af::array, or an int as it's parameters. These references can be used for assignment or returning references to af::array objects.

If the af::array is a multi-dimensional array then this coordinate will treated as the data as a linear array.

Parameters
[in]s0is sequence of linear indices
Returns
A reference to the array at the given index
array::array_proxy operator() ( const index s0,
const index s1,
const index s2 = span,
const index s3 = span 
)

This operator returns a reference of the original array at a given coordinate.

You can pass af::seq, af::array, or an int as it's parameters. These references can be used for assignment or returning references to af::array objects.

Parameters
[in]s0is sequence of indices along the first dimension
[in]s1is sequence of indices along the second dimension
[in]s2is sequence of indices along the third dimension
[in]s3is sequence of indices along the fourth dimension
Returns
A reference to the array at the given index
const array::array_proxy operator() ( const index s0,
const index s1,
const index s2 = span,
const index s3 = span 
) const

This operator returns a reference of the original array at a given coordinate.

You can pass af::seq, af::array, or an int as it's parameters. These references can be used for assignment or returning references to af::array objects.

Parameters
[in]s0is sequence of indices along the first dimension
[in]s1is sequence of indices along the second dimension
[in]s2is sequence of indices along the third dimension
[in]s3is sequence of indices along the fourth dimension
Returns
A reference to the array at the given index