Combine duplicates of sort_array_coordinates.

This unfortunately causes a bit of extra allocation for unused
parameters. Hopefully I can find a workaraound for that.
Replace Numerical Routines sorting code.

Numerical Routines source code is not re-distributable in any way at all
and is 100% incompatible with the GPL.

The replacement code originates from SLATEC, which, as a product of the
US Government, is available in the public domain.