* @param oB Second input array
     * @param axisA Axis for the first array
     * @param axisB Axis for the second array
     * @return Inner product of the two arrays.
     */
    public static PyObject innerProduct(final PyObject oA, final PyObject oB, int axisA, int axisB) {
        PyMultiarray a = PyMultiarray.ascontiguous(oA), b = PyMultiarray
                .ascontiguous(oB);
        // Check arguments
        // This next line emulates CNumeric behaviour that I'm not sure I like.
        if (a.dimensions.length == 0 || b.dimensions.length == 0) {
        	return a.__mul__(b);
        }
        final char type = PyMultiarray.commonType(a._typecode, b._typecode);
        if (axisA < 0) {
            axisA += a.dimensions.length;
        }
        if (axisB < 0) {
            axisB += b.dimensions.length;
        }
        if (axisA < 0 || axisA >= a.dimensions.length || axisB < 0
                || axisB >= b.dimensions.length) { throw Py
                .ValueError("illegal axis"); }
        if (a.dimensions[axisA] != b.dimensions[axisB]) { throw Py
                .ValueError("arrays must be of same length along given axes"); }
        // Rotate given axes to 0.
        a = PyMultiarray.rotateAxes(a, -axisA);
        b = PyMultiarray.rotateAxes(b, -axisB);
        // Now do the inner product.
        final int nDimsA = a.dimensions.length, nDimsB = b.dimensions.length;
        final int[] dimensions = new int[nDimsA + nDimsB - 2];
        final int[] aDimensions = new int[nDimsA + nDimsB - 1];
        final int[] bDimensions = new int[nDimsA + nDimsB - 1];
        for (int i = 1; i < nDimsA; i++) {
            dimensions[i - 1] = aDimensions[i] = a.dimensions[i];
            bDimensions[i] = 1;
        }
        for (int i = 1; i < nDimsB; i++) {
            dimensions[nDimsA + i - 2] = bDimensions[nDimsA + i - 1] = b.dimensions[i];
            aDimensions[nDimsA + i - 1] = 1;
        }
        aDimensions[0] = bDimensions[0] = a.dimensions[0];
        a = PyMultiarray.reshape(a, aDimensions);
        b = PyMultiarray.reshape(b, bDimensions);
        final PyMultiarray result = PyMultiarray.zeros(dimensions, type);
        for (int i = 0; i < a.dimensions[0]; i++) {
            result.__add__(PyMultiarray.asarray(PyMultiarray.asarray(a.get(i))
                    .__mul__(b.get(i))), result);
        }
        // unrotate the axes and return.
        final int[] axes = new int[result.dimensions.length];
        for (int i = 0; i < nDimsA - 1; i++) {
            axes[i] = (i + axisA) % (nDimsA - 1);
        }
        for (int i = 0; i < nDimsB - 1; i++) {
            axes[nDimsA - 1 + i] = (nDimsA - 1) + (i + axisB - 1)
                    % (nDimsB - 1);
        }
        return PyMultiarray.returnValue(PyMultiarray.transpose(result, axes));
    }