LinearFunction#
- class tqec.utils.LinearFunction(slope=1.0, offset=0.0)[source]#
Bases:
object
Represents a linear function.
A linear function is fully described with a slope and an offset.
Methods
__init__
([slope, offset])intersection
(other)Compute the intersection between two linear functions.
Attributes
offset
slope
Detailed methods
- Parameters:
slope (float)
offset (float)
- __init__(slope=1.0, offset=0.0)#
- Parameters:
slope (float)
offset (float)
- Return type:
None
- intersection(other)[source]#
Compute the intersection between two linear functions.
- Parameters:
other (LinearFunction) – the LinearFunction instance to intersect with self.
- Returns:
If they intersect, return x such that self(x) = other(x). Otherwise, return None.
- Return type:
float | None