Return to g_int_sort.f CVS log | Up to [HallC] / Analyzer / UTILSUBS |
File: [HallC] / Analyzer / UTILSUBS / g_int_sort.f
(download)
Revision: 1.1, Wed Feb 9 14:16:05 1994 UTC (30 years, 7 months ago) by cdaq Branch: MAIN CVS Tags: spring03, sep0596, sep-26-2002, sep-25-2002, sep-24-2002, sep-09-2002, sane, pionct, online07, online04, online03, oct1199, oct1194, nov2894, nov2696, mduality, may2495, may1894, mar1495, mar-24-2003, jun1794, jun1594, jun1394, jun0794, jul2895, jul0794, jan2795, jan2496, jan1896, jan1796, gep_online, gep3, fpi2, emc, e01004, dec0694, bigcal, baryon, aug1794, aug0394, aug-12-2003, apr3096, apr1594, apr0695, apr-02-2003, Initial-CVS-Release, HEAD, Extra_Shower_Tubes_on_HMS_not_SOS Initial revision |
SUBROUTINE G_int_sort(N,list,idx) *---------------------------------------------------------------------- *- *- Purpose and Methods : Sort list by increasing value *- *- Inputs : N - number of input quantities *- : list(*) - input lists in numerical order (not reorderd) *- : threshold- minimum list to consider *- Outputs : idx(*) - ordered index pointers *- *- Created 17-Jul-1993 K.B.Beard *- Modified for hall C 9/1/93: KBB * $Log: g_int_sort.f,v $ * Revision 1.1 1994/02/09 14:16:05 cdaq * Initial revision * *- *---------------------------------------------------------------------- IMPLICIT NONE integer N,list(*),idx(*) integer m,m1,temp_ID logical ordered_OK,swap *---------------------------------------------------------------------- * IF(N.LE.0) THEN !ignore if no elements RETURN ELSEIF(N.EQ.1) THEN !simple idx(1)= 1 RETURN ENDIF * *- pick out those above threshold DO m= 1,N idx(m)= m ENDDO * *- use a bubble sort to order by increasing list ordered_OK= .FALSE. DO WHILE (.not.ordered_OK) ordered_OK= .TRUE. Do m=1,N-1 !1st element m1= m+1 !next element swap= list(idx(m)).GT.list(idx(m1)) if(swap) then !swap pair temp_ID= idx(m) idx(m)= idx(m1) idx(m1)= temp_ID ordered_OK= .FALSE. !swapped at least one pair endif EndDo ENDDO * RETURN END
Analyzer/Replay: Mark Jones, Documents: Stephen Wood |
Powered by ViewCVS 0.9.2-cvsgraph-1.4.0 |