* @param axis Axis over which to sort
     * @return The indices that would sort the array.
     */
    public static PyMultiarray argSort(final PyObject o, final int axis) {
        // We depend on 'a' being 'vanilla' below.
        // There's a probable extra copy here though.
        final PyMultiarray a = PyMultiarray.array(PyMultiarray.swapAxes(
                PyMultiarray.asarray(o),
                axis,
                -1));
        if (a._typecode == 'F' || a._typecode == 'D' || a._typecode == 'O') { throw Py
                .ValueError("unsortable array type"); }
        // 'data' holds the argsorted indices.
        final int stride = a.dimensions[a.dimensions.length - 1];
        final int size = Array.getLength(a.data);
        final int data[] = new int[size];
        // Create an array of Numbers tagged with indices
        class IndexedArray {
            Number item;
            int index;
        }
        final IndexedArray ia[] = new IndexedArray[stride];
        for (int j = 0; j < stride; j++) {
            ia[j] = new IndexedArray();
        }
        // Create a comparator that sorts an IndexArray
        final Comparator<IndexedArray> comp = new Comparator<IndexedArray>() {
            public int compare(final IndexedArray o1, final IndexedArray o2) {
                if (o1.item.equals(o2.item)) {
                	return 0;
                }
                final double d1 = o1.item.doubleValue();
                final double d2 = o2.item.doubleValue();
                if (d1 > d2) {
                	return 1;
                }
                return -1;
            }
        };
        // Loop over all indices except the last.
        for (int i = 0; i < size; i += stride) {
            for (int j = 0; j < stride; j++) {
                ia[j].item = (Number) Array.get(a.data, i + j);
                ia[j].index = j;
            }
            // sort 'ia'
            java.util.Arrays.sort(ia, comp);
            // Load 'a' with the indices from 'ia' and change its type.
            for (int j = 0; j < stride; j++) {
                data[i + j] = ia[j].index;
            }
        }
        a._typecode = 'i';
        a.data = data;
        return PyMultiarray.swapAxes(a, axis, -1);
    }