flint icon indicating copy to clipboard operation
flint copied to clipboard

a more reasonable sorting of complex numbers

Open edgarcosta opened this issue 7 months ago • 3 comments

In the current sorting, we have z < conjugate(z) and conjugate(z) < z.

I propose sorting on the real part; if they overlap, use the imaginary part.

Note that in the library, _acb_vec_sort_pretty is used to sort polynomials' roots, which are multisets of non-overlapping balls. Therefore, we will obtain a predictable and stable sorting with the new comparison function.

PS: this will break some tests at Sagemath, as the roots will now come in a different order, but this is how I got into this rabbit hole.

edgarcosta avatar Jul 10 '24 15:07 edgarcosta