* @param v Values to insert into o
     * @return Array of insertion points with the same shape as v
     */
    public static PyObject searchSorted(final PyObject o, final PyObject v) {
        final PyMultiarray a = PyMultiarray.ascontiguous(o);
        PyMultiarray values = PyMultiarray.ascontiguous(v);
        if (a.dimensions.length != 1 || values.dimensions.length > 1) { throw Py
                .ValueError("searchSorted only works on 1D arrays"); }
        if (a._typecode == 'F' || a._typecode == 'D') { throw Py
                .ValueError("cannot search complex arrays"); }
        final boolean singleValue = (values.dimensions.length == 0);
        if (singleValue) {
            values = PyMultiarray.stretchAxes(values);
        }
        final PyMultiarray result = PyMultiarray.zeros(
                new int[] { values.dimensions[0] },
                'i');
        for (int i = 0; i < values.dimensions[0]; i++) {
            int start = 0, stop = a.dimensions[0] - 1;
            int j = (start + stop) / 2;
            if (a._typecode != 'O' && values._typecode != 'O') {
                final double value = ((Number) Array.get(
                        values.data,
                        values.start + i)).doubleValue();
                while (start != stop) {
                    final double val = ((Number) Array.get(a.data, a.start + j))
                            .doubleValue();
                    if ((val == value) || (stop == j)) {
                        break;
                    } else if (val < value) {
                        start = j;
                    } else {
                        stop = j;
                    }
                    j = (start + stop + 1) / 2;
                }
            } else {
                final PyObject value = values.get(i);
                while (start != stop) {
                    final PyObject val = a.get(j);
                    if (val._eq(value).__nonzero__() || (stop == j)) {
                        break;
                    } else if (val._le(value).__nonzero__()) {
                        start = j;
                    } else {
                        stop = j;
                    }
                    j = (start + stop + 1) / 2;
                }
            }
            Array.setInt(result.data, i, j);
        }
        if (singleValue) { return result.get(0); }
        return result;
    }