Skip to content
Snippets Groups Projects
Commit 5c0c54dc authored by patavirt's avatar patavirt
Browse files

src: CppAD 2024 wants ordered complex numbers

Fix compilation error.

Define lexical order for complex numbers.
parent b51b2de4
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment