diff --git a/src/common.hpp b/src/common.hpp index 4c73306601f1be0d4cb1057937f44b6557bb8c00..fd5d6809aaac25952f2f151b508fbe628c5981a5 100644 --- a/src/common.hpp +++ b/src/common.hpp @@ -63,6 +63,10 @@ namespace CppAD { COMMON_HPP_DECLARE_BINOP(*); COMMON_HPP_DECLARE_BINOP(/); #undef COMMON_HPP_DECLARE_BINOP + + /* CppAD needs comparisons; use lexical order for complex */ + bool operator <=(const Complex& a, const Complex& b) { return a.real() == b.real() ? (a.imag() <= b.imag()) : (a.real() <= b.real()); } + bool operator <(const Complex& a, const Complex& b) { return a.real() == b.real() ? (a.imag() < b.imag()) : (a.real() < b.real()); } } #endif