I want to sort the complex vector as the lexicographically order, that is first the real part from large to small, the same real part, image part from small to large.
julia> a = ComplexF64[-0.05050274530206651 + 0.6013860908906193im, -0.050502745302066526 - 0.6013860908906193im, -1.1280686832693614 + 0.7017876343969567im, -1.1280686832693616 - 0.7017876343969567im]
4-element Vector{ComplexF64}:
-0.05050274530206651 + 0.6013860908906193im
-0.050502745302066526 - 0.6013860908906193im
-1.1280686832693614 + 0.7017876343969567im
-1.1280686832693616 - 0.7017876343969567im
julia> sort(a, by = x -> (real(x), -imag(x)), rev=true)
4-element Vector{ComplexF64}:
-0.05050274530206651 + 0.6013860908906193im
-0.050502745302066526 - 0.6013860908906193im
-1.1280686832693614 + 0.7017876343969567im
-1.1280686832693616 - 0.7017876343969567im
The -0.05050274530206651 and -0.050502745302066526 may consider the same value.
How to achieve the order
-0.050502745302066526 - 0.6013860908906193im
-0.05050274530206651 + 0.6013860908906193im
-1.1280686832693616 - 0.7017876343969567im
-1.1280686832693614 + 0.7017876343969567im