View source on GitHub |
Wrapper for periodic numerical values.
cirq.PeriodicValue(
value: Union[int, float, sympy.Expr], period: Union[int, float, sympy.Expr]
)
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.
Args | |
---|---|
value
|
numerical value to wrap. |
period
|
periodicity of the numerical value. |
Methods
__eq__
__eq__(
other: Any
) -> bool
Return self==value.
__ne__
__ne__(
other: Any
) -> bool
Return self!=value.