I work with Julia 1.5.1 on Linux. I have this array
x = [0.3575631591952295;
-1.2891687824408367;
-0.5123400980902758;
-1.61271953171407;
1.0854706981323956;
0.2748568949784879;
1.6127195317140701;
0.021835136639906272;
0.27038905630106824;
-0.20860606471597504]
When I do sortperm
I expect to get
8
2
3
1
9
7
10
5
6
4
but I get
sortperm(x)
10-element Array{Int64,1}:
4
2
3
10
8
9
6
1
5
7
which makes no sense.
Note however that sort()
do work correctly
sort(x)
10-element Array{Float64,1}:
-1.61271953171407
-1.2891687824408367
-0.5123400980902758
-0.20860606471597504
0.021835136639906272
0.27038905630106824
0.2748568949784879
0.3575631591952295
1.0854706981323956
1.6127195317140701
and on some other examples sortperm
work.
Am I doing something wrong? Is there something I don’t see? Can someone reproduce that error ?