unwrap

Contents

unwrap#

Unwrap phase-like values by replacing jumps larger than a discontinuity with their period-complementary values. This function is not optimized for parallel performance.

This matches NumPy’s unwrap characteristics:

  • Operates along a selected axis (default: last axis)

  • Uses a configurable period (default: 2*pi)

  • Treats discont < period/2 as period/2

template<typename Op>
__MATX_INLINE__ auto matx::unwrap(const Op &op, int axis = -1, detail::value_promote_t<typename Op::value_type> discont = static_cast<detail::value_promote_t<typename Op::value_type>>(-1), detail::value_promote_t<typename Op::value_type> period = static_cast<detail::value_promote_t<typename Op::value_type>>(cuda::std::numbers::pi_v<detail::value_promote_t<typename Op::value_type>> * 2))#

Unwrap phase angles by correcting jumps greater than a discontinuity.

This implementation follows NumPy’s unwrap behavior, including support for custom period and discont values.

Template Parameters:

Op – Input operator/tensor type

Parameters:
  • op – Input operator

  • axis – Axis to unwrap. Default is last axis (-1)

  • discont – Maximum discontinuity between adjacent samples. Values lower than period / 2 are treated as period / 2.

  • period – Complement period used to unwrap phase values. Default is 2*pi.

Examples#

(out1_default = unwrap(in1)).run(exec);