00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include <metis.h>
00017
00018
00019
00020
00021
00022
00023
00024
00025 void BucketSortKeysInc(int n, int max, idxtype *keys, idxtype *tperm, idxtype *perm)
00026 {
00027 int i, ii;
00028 idxtype *counts;
00029
00030 counts = idxsmalloc(max+2, 0, "BucketSortKeysInc: counts");
00031
00032 for (i=0; i<n; i++)
00033 counts[keys[i]]++;
00034 MAKECSR(i, max+1, counts);
00035
00036 for (ii=0; ii<n; ii++) {
00037 i = tperm[ii];
00038 perm[counts[keys[i]]++] = i;
00039 }
00040
00041 free(counts);
00042 }
00043