The C++ interface for shift. More...

array shift (const array &in, int dim0=0, int dim1=0, int dim2=0, int dim3=0)
 Shift the values of an array around dimension (wrap around). More...
 
array shift (const array &in, const array &shift)
 Shift the values of an array around dimension (wrap around). More...
 

Detailed Description

The C++ interface for shift.

array a(seq(5)); //a=[0 1 2 3 4]
a = shift(a,2); //a=[3 4 0 1 2]
array a(seq(5)); //a=[0 1 2 3 4]
array b = constant(1,1,af::s32);
a = shift(a,b); //a=[4 0 1 2 3]

Function Documentation

array af::shift ( const array &  in,
int  dim0 = 0,
int  dim1 = 0,
int  dim2 = 0,
int  dim3 = 0 
)

Shift the values of an array around dimension (wrap around).

array a(seq(5)); //a=[0 1 2 3 4]
a = shift(a,2); //a=[3 4 0 1 2]
Parameters
[in]in
[in]dim0Shift along first dimension
[in]dim1Shift along second dimension
[in]dim2Shift along third dimension
[in]dim3Shift along fourth dimension
Returns
shifted version of array
array af::shift ( const array &  in,
const array &  shift 
)

Shift the values of an array around dimension (wrap around).

array a(seq(5)); //a=[0 1 2 3 4]
array b = constant(1,1,af::s32);
a = shift(a,b); //a=[4 0 1 2 3]
Parameters
[in]in
[in]shiftinteger array (s32 preferred) indicating shifts for each dimension
Returns
shifted version of array