30 throw new ArgumentOutOfRangeException(
33 "Candidate-deque capacity must be positive.");
36 _slope = ArrayPool<double>.Shared.Rent(capacity);
37 _intercept = ArrayPool<double>.Shared.Rent(capacity);
38 _startX = ArrayPool<double>.Shared.Rent(capacity);
39 _period = ArrayPool<int>.Shared.Rent(capacity);
82 if (!
double.IsFinite(slope) ||
83 !
double.IsFinite(intercept))
85 throw new ArithmeticException(
86 "Federgruen-Tzur candidate coefficients must be finite.");
91 var lastSlope = _slope[_tail];
93 if (slope > lastSlope)
95 throw new InvalidOperationException(
96 "A linear Federgruen-Tzur specialization received " +
97 "nonmonotone candidate slopes.");
100 if (slope < lastSlope)
105 if (_intercept[_tail] <= intercept)
113 var activationX =
double.NegativeInfinity;
117 activationX = IntersectionX(
123 if (_tail == _head ||
124 activationX > _startX[_tail])
134 activationX =
double.NegativeInfinity;
138 activationX = IntersectionX(
147 _period[_tail] = period;
148 _slope[_tail] = slope;
149 _intercept[_tail] = intercept;
150 _startX[_tail] = activationX;
225 ArrayPool<double>.Shared.Return(_slope, clearArray:
false);
226 ArrayPool<double>.Shared.Return(_intercept, clearArray:
false);
227 ArrayPool<double>.Shared.Return(_startX, clearArray:
false);
228 ArrayPool<int>.Shared.Return(_period, clearArray:
false);