cirq.PeriodicValue

class cirq.PeriodicValue(value: Union[int, float], period: Union[int, float])[source]

Wrapper for periodic numerical values.

Wrapper for periodic numerical types which implements __eq__, __ne__,
__hash__ and _approx_eq_ so that values which are in the same
equivalence class are treated as equal.
Internally the value passed to __init__ is normalized to the interval
[0, period) and stored as that. Specialized version of _approx_eq_ is
provided to cover values which end up at the opposite edges of this
interval.
__init__(value: Union[int, float], period: Union[int, float])[source]

Initializes the equivalence class.

Parameters
  • value – numerical value to wrap.

  • period – periodicity of the numerical value.