*     convolution, the signals do not overlap completely, and boundary
     *     effects may be seen.
     * @return Discrete, linear convolution of oA0 and oB0
     */
    public static PyMultiarray convolve(final PyObject oA0, final PyObject oB0, final int mode) {
        PyMultiarray a0 = PyMultiarray.asarray(oA0), b0 = PyMultiarray
                .asarray(oB0);
        // Check arguments (If anyone cares, the 1d requirement could probably
        // be relaxed.)
        if (a0.dimensions.length != 1 || b0.dimensions.length != 1) { throw Py
                .ValueError("convolve only works on 1D arrays"); }
        // Make the arrays contiguous and then make a copy of the nondata parts.
        a0 = PyMultiarray.ascontiguous(a0);
        b0 = PyMultiarray.ascontiguous(b0);
        final PyMultiarray a = new PyMultiarray(
                a0.data,
                a0._typecode,
                a0.start,
                a0.dimensions.clone(),
                a0.strides.clone());
        final PyMultiarray b = new PyMultiarray(
                b0.data,
                b0._typecode,
                b0.start,
                b0.dimensions.clone(),
                b0.strides.clone());
        // Create the result array.
        final char type = PyMultiarray.commonType(a._typecode, b._typecode);
        int padl = 0;
        int length = Math.max(a.dimensions[0], b.dimensions[0]);
        final int n = Math.min(a.dimensions[0], b.dimensions[0]);
        switch (mode) {
        case 0:
            length = length - n + 1;
            break;
        case 1:
            padl = n / 2;
            break;
        case 2:
            length = length + n - 1;
            padl = n - 1;
            break;
        default:
            throw Py.ValueError("mode must be 0, 1, or 2");
        }
        // Create the result.
        final PyMultiarray result = PyMultiarray.zeros(
                new int[] { length },
                type);
        final int aSize = PyMultiarray.typeToNElements(a._typecode);
        final int bSize = PyMultiarray.typeToNElements(b._typecode);
        a.strides[0] = -1;
        a.isContiguous = false;
        for (int i = (n - padl - 1); i < length + (n - padl - 1); i++) {
            final int j0 = Math.max(0, i - (a0.dimensions[0] - 1));
            final int j1 = Math.min(i + 1, b0.dimensions[0]);
            a.start = a0.start + aSize * (i - j0);
            b.start = b0.start + bSize * j0;
            a.dimensions[0] = b.dimensions[0] = j1 - j0;
            result.set(i - (n - padl - 1), Umath.add.reduce(a.__mul__(b)));
        }
        return result;
    }