PyMultiarray absComplexDouble(final PyMultiarray a) {
        // Assumes a continuous array.
        final int length = PyMultiarray.shapeToNItems(a.dimensions);
        final double[] aData = (double[]) a.data;
        final double[] result = new double[length];
        for (int i = a.start, j = 0; j < length; i += 2, j++) {
            result[j] = Math.sqrt(aData[i] * aData[i] + aData[i + 1]
                    * aData[i + 1]);
        }
        return new PyMultiarray(
                result,
                'd',
                0,
                new int[] { length },
                new int[] { 1 });
    }