6 static int egcmp(
const void *pa,
const void *pb);
15 buff = (
double *)
G_malloc(bands * (bands + 1) *
sizeof(double));
16 tmp = (
double **)
G_malloc(bands *
sizeof(
double *));
17 for (i = 0; i < bands; i++)
18 tmp[i] = &buff[i * (bands + 1)];
21 for (i = 0; i < bands; i++) {
22 for (j = 0; j < bands; j++)
23 tmp[i][j + 1] = z[j][i];
28 qsort(tmp, bands,
sizeof(
double *), egcmp);
31 for (i = 0; i < bands; i++) {
32 for (j = 0; j < bands; j++)
33 z[j][i] = tmp[i][j + 1];
46 static int egcmp(
const void *pa,
const void *pb)
48 const double *a = *(
const double *
const *)pa;
49 const double *
b = *(
const double *
const *)pb;
void G_free(void *)
Free allocated memory.