piecewise_linear_1D_DoF#

cuqi.utilities.piecewise_linear_1D_DoF(x, threshold=1e-05, exception_zero=False, exception_flat=False)#

Returns the degrees of freedom of a piecewise linear signal. Assuming linear interpolation, this corresponds to the number of non-differentiable points, including end-points.

Parameters:
  • x (np.ndarray) – 1D Array to compute degrees of freedom of.

  • threshold (float) – Strict theshold on when values are considered zero.

  • exception_zero (Boolean) – Whether a zero piecewise linear components should be considered.

  • exception_flat (Boolean) – Whether a flat piecewise linear components should be considered.