%N sortidxd %F $MIR/src/subs/sortidx.for
%D Index sort of a an array of double precision values
%P pjt
%: sorting, indexing
%B
      subroutine sortidxd (n, x ,idx)

      integer n, idx(n)
      double precision x(n)

  sortidxX:  (shell) sort of an array into a integer index-array
               See also e.g. K&R pp108
       Various versions exist:
           sortidxa    index sorting of character array
           sortidxi    index sorting of integer array
           sortidxr    index sorting of real array
           sortidxd    index sorting of double precision array

       input:  x[]   array of values
               n     number of elements in x to sort

       output: idx[] 'pointer' array, such that x[idx[i-1]]<x[idx[i]] for
                     i=2..n
