shift#
Shift an operator by a given amount either positive or negative along one dimension. The shift amount can be a scalar (uniform shift) or a rank-1 operator to shift each row or column by a different amount.
Added in version 0.3.0.
-
template<int DIM, typename OpT, typename ShiftOpT>
auto __MATX_INLINE__ matx::shift(const OpT &op, ShiftOpT s)# Operator to shift dimension by a given amount
- Template Parameters:
DIM – The dimension to be shifted
OpT – Type of operator or view
ShiftOpT – Type of the operator for the shift
- Parameters:
op – Operator or view to shift
s – Operator which returns the shift
- Returns:
New operator with shifted indices
-
template<int DIM, int... DIMS, typename OpT, typename ShiftT, typename ...ShiftsT>
auto __MATX_INLINE__ matx::shift(const OpT &op, ShiftT s, ShiftsT... shifts)# Operator to shift dimension by a given amount. This version allows multiple dimensions.
- Template Parameters:
DIM – The dimension to be shifted
DIMS... – The dimensions targeted for shifts
OpT – Type of operator or view
ShiftsT – Type of the shift operators
- Parameters:
op – Operator or view to shift
s – Amount to shift forward
shifts – list of shift amounts
- Returns:
New operator with shifted indices
Examples#
Shift all rows by the same amount:
// Shift the first dimension of "t2" by -5 so the 5th element of "t2" is the first element of "t2s"
(t2s = shift<0>(t2, -5)).run(exec);
Shift each column by a different amount using a rank-1 operator:
// Shift dim 0 of "t2r1" using a 1D operator "shifts_col" so each column is shifted by a different amount
(t2r1s = shift<0>(t2r1, shifts_col)).run(exec);