|
| constexpr bool | operator== (const Dual &, const Dual &)=default |
| constexpr bool | operator< (const Dual &a, const Dual &b) |
| | Lexicographic total order: primal first, tangent breaks ties.
|
|
constexpr Dual | operator+ (const Dual &a, const Dual &b) |
|
constexpr Dual | operator- (const Dual &a, const Dual &b) |
|
constexpr Dual | operator* (const Dual &a, const Dual &b) |
|
constexpr Dual | operator/ (const Dual &a, const Dual &b) |
template<typename F>
requires std::semiregular<F> && (!std::floating_point<F>)
class dedekind::linear_algebra::Dual< F >
Represents f(x) + f'(x)ε.
Structural C++20 NTTP-compatible layout: primal / tangent fields are public so the type can be used as a non-type template parameter (e.g. Halfspace2D<Dual<Rat>, …> for parametric LP). Backward-compatible accessors value() / derivative() are kept for existing call sites.
template<typename F>
| bool operator< |
( |
const Dual< F > & | a, |
|
|
const Dual< F > & | b ) |
|
friend |
Lexicographic total order: primal first, tangent breaks ties.
a < b iff a.val < b.val, or equal primal with a.der < b.der. This is a total order whose induced equality is operator== (which compares both components), so trichotomy holds and any order-extremum over Dual — e.g. the tropical ⊕ = max — is commutative (a genuine semiring join, not an argument-order artefact). On a primal tie the extremum carries the larger tangent, the upper subgradient: a deterministic, valid selection at a point where max is non-differentiable. The primal alone still fixes the optimum's value (a tie is equal-primal); the tangent only decides which representative is carried out of the tie, so downstream argmax (e.g. dedekind.optimization:lp) keeps the same optimal value, with degenerate ties now broken deterministically.