38 lhs: Optional[Range], rhs: Optional[Range]
40 """Merges the two optional ranges.
43 lhs: The left hand side range.
44 rhs: The right hand side range.
47 A merged range (None if both lhs and rhs are None).
54 minimum=min(lhs.minimum, rhs.minimum),
55 maximum=max(lhs.maximum, rhs.maximum),
60 """Returns the range of the absolute values of the finite non-zeros.
63 values: An iterable object of float values.
66 The range of the absolute values of the finite non-zeros, None if no such
69 minimum: Optional[float] =
None
70 maximum: Optional[float] =
None
73 if math.isinf(v)
or v == 0.0:
79 minimum = min(minimum, v)
80 maximum = max(maximum, v)
82 assert (maximum
is None) == (minimum
is None), (minimum, maximum)
86 return Range(minimum=minimum, maximum=maximum)
89@dataclasses.dataclass(frozen=True)