/* MYSORT.C: a simple C program for sorting a list of numbers and an associated * ordered sequence for the list (0 to n-1), returning the sorted list * and the permuted indices * * John Rust, University of Maryland, July, 2003 */ int mysort(double *x,double *slist,int *sindex,int n) { int i,j,jj,mi,mis,loop,*ls,*index; double *xs,*list,mn; xs=(double *) malloc(n*sizeof(double)); list=(double *) malloc(n*sizeof(double)); ls=(int *) malloc(n*sizeof(int)); index=(int *) malloc(n*sizeof(int)); loop=0; for (i=0; i 0) { for (i=0; i