10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-03 01:45:59 +02:00

Fixed selection sort

This commit is contained in:
Anthony Scemama 2017-04-19 15:44:24 +02:00
parent 1ac36ab762
commit 9b4131139b

View File

@ -318,13 +318,11 @@ BEGIN_TEMPLATE
xtmp = x(i) xtmp = x(i)
i0 = iorder(i) i0 = iorder(i)
j = i-1_8 j = i-1_8
do j=i-1_8,1_8,-1_8 do while (x(j)<xtmp)
if ( x(j) > xtmp ) then x(j+1_8) = x(j)
x(j+1_8) = x(j) iorder(j+1_8) = iorder(j)
iorder(j+1_8) = iorder(j) j = j-1_8
else if (j<1_8) exit
exit
endif
enddo enddo
x(j+1_8) = xtmp x(j+1_8) = xtmp
iorder(j+1_8) = i0 iorder(j+1_8) = i0