/* nag_rank_sort (m01dsc) Example Program. * * Copyright 1990 Numerical Algorithms Group. * * Mark 4, 1996. * Mark 5 revised, 1998. * Mark 7 revised, 2001. * Mark 8 revised, 2004. * */ #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif static Integer NAG_CALL compare(const Nag_Pointer a, const Nag_Pointer b) { double x = *((const double *)a); double y = *((const double *)b); return (x=1) { if ( !( vec = NAG_ALLOC(n, double)) || !( rank = NAG_ALLOC(n, size_t)) ) { Vprintf("Allocation failure\n"); exit_status = -1; goto END; } } else { Vprintf("Invalid n or step.\n"); exit_status = 1; return exit_status; } for (i=0; i