/** * Create a new Array as a subsection of this Array, with rank reduction. * No data is moved, so the new Array references the same backing store as the original. * * @param ranges list of Ranges that specify the array subset. * Must be same rank as original Array. * A particular Range: 1) may be a subset, or 2) may be null, meaning use entire Range. * If Range[dim].length == 1, then the rank of the resulting Array is reduced at that dimension. * @return the new Array * @throws InvalidRangeException if ranges is invalid */ public Array section(List<Range> ranges) throws InvalidRangeException { return createView(indexCalc.section(ranges)); }
/** * Create a new Array as a subsection of this Array, with rank reduction. * No data is moved, so the new Array references the same backing store as the original. * * @param ranges list of Ranges that specify the array subset. * Must be same rank as original Array. * A particular Range: 1) may be a subset, or 2) may be null, meaning use entire Range. * If Range[dim].length == 1, then the rank of the resulting Array is reduced at that dimension. * @return the new Array * @throws InvalidRangeException if ranges is invalid */ public Array section(List<Range> ranges) throws InvalidRangeException { return createView(indexCalc.section(ranges)); }
/** * Create a new Array as a subsection of this Array, with rank reduction. * No data is moved, so the new Array references the same backing store as the original. * * @param ranges list of Ranges that specify the array subset. * Must be same rank as original Array. * A particular Range: 1) may be a subset, or 2) may be null, meaning use entire Range. * If Range[dim].length == 1, then the rank of the resulting Array is reduced at that dimension. * @return the new Array * @throws InvalidRangeException if ranges is invalid */ public Array section(List<Range> ranges) throws InvalidRangeException { return createView(indexCalc.section(ranges)); }
/** * Create a new Array as a subsection of this Array, with rank reduction. * No data is moved, so the new Array references the same backing store as the original. * <p/> * * @param origin int array specifying the starting index. Must be same rank as original Array. * @param shape int array specifying the extents in each dimension. * This becomes the shape of the returned Array. Must be same rank as original Array. * If shape[dim] == 1, then the rank of the resulting Array is reduced at that dimension. * @param stride int array specifying the strides in each dimension. If null, assume all ones. * @return the new Array * @throws InvalidRangeException if ranges is invalid */ public Array section(int[] origin, int[] shape, int[] stride) throws InvalidRangeException { List<Range> ranges = new ArrayList<>(origin.length); if (stride == null) { stride = new int[origin.length]; for (int i = 0; i < stride.length; i++) stride[i] = 1; } for (int i = 0; i < origin.length; i++) ranges.add(new Range(origin[i], origin[i] + stride[i] * shape[i] - 1, stride[i])); return createView(indexCalc.section(ranges)); }
/** * Create a new Array as a subsection of this Array, with rank reduction. * No data is moved, so the new Array references the same backing store as the original. * <p/> * * @param origin int array specifying the starting index. Must be same rank as original Array. * @param shape int array specifying the extents in each dimension. * This becomes the shape of the returned Array. Must be same rank as original Array. * If shape[dim] == 1, then the rank of the resulting Array is reduced at that dimension. * @param stride int array specifying the strides in each dimension. If null, assume all ones. * @return the new Array * @throws InvalidRangeException if ranges is invalid */ public Array section(int[] origin, int[] shape, int[] stride) throws InvalidRangeException { List<Range> ranges = new ArrayList<>(origin.length); if (stride == null) { stride = new int[origin.length]; for (int i = 0; i < stride.length; i++) stride[i] = 1; } for (int i = 0; i < origin.length; i++) ranges.add(new Range(origin[i], origin[i] + stride[i] * shape[i] - 1, stride[i])); return createView(indexCalc.section(ranges)); }
/** * Create a new Array as a subsection of this Array, with rank reduction. * No data is moved, so the new Array references the same backing store as the original. * <p/> * * @param origin int array specifying the starting index. Must be same rank as original Array. * @param shape int array specifying the extents in each dimension. * This becomes the shape of the returned Array. Must be same rank as original Array. * If shape[dim] == 1, then the rank of the resulting Array is reduced at that dimension. * @param stride int array specifying the strides in each dimension. If null, assume all ones. * @return the new Array * @throws InvalidRangeException if ranges is invalid */ public Array section(int[] origin, int[] shape, int[] stride) throws InvalidRangeException { List<Range> ranges = new ArrayList<Range>(origin.length); if (stride == null) { stride = new int[origin.length]; for (int i = 0; i < stride.length; i++) stride[i] = 1; } for (int i = 0; i < origin.length; i++) ranges.add(new Range(origin[i], origin[i] + stride[i] * shape[i] - 1, stride[i])); return createView(indexCalc.section(ranges)); }