final static void modComplexDouble(int sa, final PyMultiarray a, int sb, final PyMultiarray b, int sr, final PyMultiarray r, final int d) {
        final int dsa = a.strides[d], dsb = b.strides[d], dsr = r.strides[d], finalSr = sr
                + r.dimensions[d] * r.strides[d];
        if (d == r.dimensions.length - 1) {
            final double[] aData = (double[]) a.data, bData = (double[]) b.data;
            final double[] rData = (double[]) r.data;
            for (; sr != finalSr; sa += dsa, sb += dsb, sr += dsr) {
                final double reA = aData[sa], imA = aData[sa + 1], reB = bData[sb], imB = bData[sb + 1];
                final double den = reB * reB + imB * imB;
                final double n = Math.floor((reA * reB + imA * imB) / den);
                rData[sr] = reA - n * reB;
                rData[sr + 1] = imA - n * imB;
            }
        } else {
            for (; sr != finalSr; sa += dsa, sb += dsb, sr += dsr) {
                PyMultiarray.modComplexDouble(sa, a, sb, b, sr, r, d + 1);
            }
        }
    }