public static long[] getReducedShape(int[] wholeShape, int[] dimensions) {
        if (isWholeArray(wholeShape, dimensions))
            return new long[] {};
        else if (dimensions.length == 1 && wholeShape.length == 2) {
            val ret = new long[2];
            if (dimensions[0] == 1) {
                ret[0] = wholeShape[0];
                ret[1] = 1;
            } else if (dimensions[0] == 0) {
                ret[0] = 1;
                ret[1] = wholeShape[1];
            }
            return ret;
        }

        return ArrayUtil.toLongArray(ArrayUtil.removeIndex(wholeShape, dimensions));
    }
public static long [ ] getReducedShape ( int [ ] wholeShape , int [ ] dimensions ) { if ( isWholeArray ( wholeShape , dimensions ) ) return new long [ ] { } ; else if ( dimensions . length == 1 && wholeShape . length == 2 ) { val ret = new long [ 2 ] ; if ( dimensions [ 0 ] == 1 ) { ret [ 0 ] = wholeShape [ 0 ] ; ret [ 1 ] = 1 ; } else if ( dimensions [ 0 ] == 0 ) { ret [ 0 ] = 1 ; ret [ 1 ] = wholeShape [ 1 ] ; } return ret ; } return ArrayUtil . toLongArray ( ArrayUtil . removeIndex ( wholeShape , dimensions ) ) ; }
Get the shape of the reduced array
@param wholeShape the shape of the array
with the reduce op being performed
@param dimensions the dimensions the reduce op is being performed on
@return the shape of the result array as the result of the reduce