Recursively splits pixels between indexStart to indexStart+length.  A split happens if there is a pixel
more than the desired distance away from the two end points. Results are placed into 'splits'
550075
protected void splitPixels(int indexStart, int length) {
		// too short to split
		if( length < minimumSideLengthPixel)
			return;

		// end points of the line
		int indexEnd = (indexStart+length)%N;

		int splitOffset = selectSplitOffset(indexStart,length);

		if( splitOffset >= 0 ) {
//			System.out.println("  splitting ");
			splitPixels(indexStart, splitOffset);
			int indexSplit = (indexStart+splitOffset)%N;
			splits.add(indexSplit);
			splitPixels(indexSplit, circularDistance(indexSplit, indexEnd));
		}
	}
17492
void split(treeNode parent, Point newCentre, int newCentreIndex){
		
		//loop counter variable
		int i;

		//1. Counts how many points belong to the new and how many points belong to the old centre
		int nOld = 0;
		int nNew = 0;
		for(i=0;i<parent.n;i++){
			Point centre = determineClosestCentre(parent.points[i], parent.centre, newCentre);
			if(centre == newCentre){
				nNew++;
			} else {
				nOld++;
			} 
		}

		//2. initalizes the arrays for the pointer
		
		//array for pointer on the points belonging to the old centre
		Point[] oldPoints = new Point[nOld];

		//array for pointer on the points belonging to the new centre
		Point[] newPoints = new Point[nNew];

		int indexOld = 0;
		int indexNew = 0;

		for(i=0;i<parent.n;i++){
			Point centre = determineClosestCentre(parent.points[i],parent.centre,newCentre);
			if(centre == newCentre){
				newPoints[indexNew] = parent.points[i];
				newPoints[indexNew].centreIndex = newCentreIndex;
				indexNew++;
			} else if(centre == parent.centre){
				oldPoints[indexOld] = parent.points[i];
				indexOld++;
			} else {
				//printf("ERROR !!! NO CENTER NEAREST !! \n");
			}
		}

		//left child: old centre
		treeNode lc = new treeNode(nOld, oldPoints, 
						parent.centre, parent);
		/*lc.centre = parent.centre;
		lc.points = oldPoints;
		lc.n = nOld;

		lc.lc = null;
		lc.rc = null;
		lc.parent = parent;

		treeNodeTargetFunctionValue(lc);*/
		
		//right child: new centre
		treeNode rc = new treeNode(nNew, newPoints, newCentre, 
							 parent);
		/*rc.centre = newCentre;
		rc.points = newPoints;
		rc.n = nNew;

		rc.lc = null;
		rc.rc = null;
		rc.parent = parent;

		treeNodeTargetFunctionValue(rc);*/

		//set childs of the parent node
		parent.lc = lc;
		parent.rc = rc;

		//propagate the cost changes to the parent nodes
		while(parent != null){
			parent.cost = parent.lc.cost + parent.rc.cost;
			parent = parent.parent;
		}

	}
1143698
public Slice slice(int index, int length)
    {
        if (index == 0 && length == this.length) {
            return this;
        }

        checkPositionIndexes(index, index + length, this.length);
        if (index >= 0 && length == 0) {
            return Slices.EMPTY_SLICE;
        }
        return new Slice(data, offset + index, length);
    }
749079
function(length, opt) {

            var segments = this.segments;
            var numSegments = segments.length;
            if (numSegments === 0) return null; // if segments is an empty array

            var fromStart = true;
            if (length < 0) {
                fromStart = false; // negative lengths mean start calculation from end point
                length = -length; // absolute value
            }

            opt = opt || {};
            var precision = (opt.precision === undefined) ? this.PRECISION : opt.precision;
            var segmentSubdivisions = (opt.segmentSubdivisions === undefined) ? this.getSegmentSubdivisions({ precision: precision }) : opt.segmentSubdivisions;
            // not using localOpt

            var lastVisibleSegmentIndex = null;
            var l = 0; // length so far
            for (var i = (fromStart ? 0 : (numSegments - 1)); (fromStart ? (i < numSegments) : (i >= 0)); (fromStart ? (i++) : (i--))) {

                var segment = segments[i];
                var subdivisions = segmentSubdivisions[i];
                var d = segment.length({ precision: precision, subdivisions: subdivisions });

                if (segment.isVisible) {
                    if (length <= (l + d)) return i;
                    lastVisibleSegmentIndex = i;
                }

                l += d;
            }

            // if length requested is higher than the length of the path, return last visible segment index
            // if no visible segment, return null
            return lastVisibleSegmentIndex;
        }
1280861
def split(self, index):
        
        lb = _PListBuilder()
        right_list = self
        i = 0
        while right_list and i < index:
            lb.append_elem(right_list.first)
            right_list = right_list.rest
            i += 1

        if not right_list:
            # Just a small optimization in the cases where no split occurred
            return self, _EMPTY_PLIST

        return lb.build(), right_list
805993
private void divide(int[] idx, double[] data, ArrayList<int[]> ret, int start, int end, int depth) {
    if(depth == 0) {
      int[] a = Arrays.copyOfRange(idx, start, end);
      Arrays.sort(a);
      ret.add(a);
      return;
    }
    final int count = end - start;
    if(count == 0) {
      // Corner case, that should barely happen. But for ties, we currently
      // Do not yet assure that it doesn't happen!
      for(int j = 1 << depth; j > 0; --j) {
        ret.add(new int[0]);
      }
      return;
    }
    double m = 0.;
    for(int i = start; i < end; i++) {
      m += data[i];
    }
    m /= count;
    int pos = Arrays.binarySearch(data, start, end, m);
    if(pos >= 0) {
      // Ties: try to choose the most central element.
      final int opt = (start + end) >> 1;
      while(data[pos] == m) {
        if(pos < opt) {
          pos++;
        }
        else if(pos > opt) {
          pos--;
        }
        else {
          break;
        }
      }
    }
    else {
      pos = (-pos - 1);
    }
    divide(idx, data, ret, start, pos, depth - 1);
    divide(idx, data, ret, pos, end, depth - 1);
  }
678119
def split_block_by_row_length(block, split_row_length):
    '''
    
    '''
    split_blocks = []
    current_block = []
    for row in block:
        if row_content_length(row) <= split_row_length:
            if current_block:
                split_blocks.append(current_block)
            split_blocks.append([row])
            current_block = []
        else:
            current_block.append(row)
    if current_block:
        split_blocks.append(current_block)

    return split_blocks
450083
function split(arr, size) {
  var out = [];
  var sizes = [];
  var where = size - 1;
  var ptr = 0;
  var i, j;

  for (i = arr.length - 1; i >= 0; i--) {
    sizes[where] = (sizes[where] || 0) + 1;
    if (--where === -1) where = size - 1;
  }

  for (i = 0; i < size; i++) {
    for (j = 0; j < sizes[i]; j++) {
      if (j === 0) out[i] = [arr[ptr]];
      else out[i].push(arr[ptr]);
      ptr++;
    }
  }

  return out;
}
663872
def split(self, indices_or_sections, axis=0):
        """"""
        if not isinstance(indices_or_sections, numbers.Integral):
            raise Error('splitting by array of indices is not yet implemented')
        n = indices_or_sections
        if self.shape[axis] % n != 0:
            raise ValueError("Array split doesn't result in an equal division")
        step = self.shape[axis] / n
        pieces = []
        start = 0
        while start < self.shape[axis]:
            stop = start + step
            ix = [slice(None)] * self.ndim
            ix[axis] = slice(start, stop)
            ix = tuple(ix)
            pieces.append(self[ix])
            start += step
        return pieces
886698
def _split_index(self, key):
        
        if not isinstance(key, tuple):
            key = (key,)
        elif key == ():
            return (), ()

        if key[0] is Ellipsis:
            num_pad = self.ndims - len(key) + 1
            key = (slice(None),) * num_pad + key[1:]
        elif len(key) < self.ndims:
            num_pad = self.ndims - len(key)
            key = key + (slice(None),) * num_pad

        map_slice = key[:self.ndims]
        if self._check_key_type:
            map_slice = self._apply_key_type(map_slice)
        if len(key) == self.ndims:
            return map_slice, ()
        else:
            return map_slice, key[self.ndims:]
420114
public int split(T obj, int start, int length) throws IOException
    {
        int count = 0;
        if (length > 0)
        {
            int end = (start + length) % size;
            if (start < end)
            {
                count = op(obj, start, end);
            }
            else
            {
                if (end > 0)
                {
                    count = op(obj, start, size, 0, end);
                }
                else
                {
                    count = op(obj, start, size);
                }
            }
        }
        assert count <= length;
        return count;
    }
1362739
function splitDataNode(node, index, positionsToPreserve) {
            var newNode = node.cloneNode(false);
            newNode.deleteData(0, index);
            node.deleteData(index, node.length - index);
            insertAfter(newNode, node);

            // Preserve positions
            if (positionsToPreserve) {
                for (var i = 0, position; position = positionsToPreserve[i++]; ) {
                    // Handle case where position was inside the portion of node after the split point
                    if (position.node == node && position.offset > index) {
                        position.node = newNode;
                        position.offset -= index;
                    }
                    // Handle the case where the position is a node offset within node's parent
                    else if (position.node == node.parentNode && position.offset > getNodeIndex(node)) {
                        ++position.offset;
                    }
                }
            }
            return newNode;
        }
436872
def set_split_extents_by_split_size(self):
        

        if self.split_size is None:
            if (
                _np.all([s is not None for s in self.split_num_slices_per_axis])
                and
                _np.all([s > 0 for s in self.split_num_slices_per_axis])
            ):
                self.split_size = _np.product(self.split_num_slices_per_axis)
            else:
                raise ValueError(
                    (
                        "Got invalid self.split_num_slices_per_axis=%s, all elements "
                        +
                        "need to be integers greater than zero when self.split_size is None."
                    )
                    %
                    self.split_num_slices_per_axis
                )
        self.logger.debug(
            "Pre  cannonicalise: self.split_num_slices_per_axis=%s",
            self.split_num_slices_per_axis)
        self.split_num_slices_per_axis = \
            calculate_num_slices_per_axis(
                self.split_num_slices_per_axis,
                self.split_size,
                self.array_shape
            )
        self.logger.debug(
            "Post cannonicalise: self.split_num_slices_per_axis=%s",
            self.split_num_slices_per_axis)
        # Define the start and stop indices (extents) for each axis slice
        self.split_shape = self.split_num_slices_per_axis.copy()
        self.split_begs = [[], ] * len(self.array_shape)
        self.split_ends = [[], ] * len(self.array_shape)
        for i in range(len(self.array_shape)):
            self.split_begs[i], self.split_ends[i] = \
                self.calculate_axis_split_extents(
                    self.split_shape[i],
                    self.array_shape[i]
            )
876026
def split_image(self, split_len):
        
        result = copy.copy(self)
        result.data = self.data[:split_len]
        self.data = self.data[split_len:]
        self.addr += split_len
        self.file_offs = None
        result.file_offs = None
        return result
462633
public static int findSplitpoint(String s, int width) {
    // the newline (or EOS) is the fallback split position.
    int in = s.indexOf(NEWLINE);
    in = in < 0 ? s.length() : in;
    // Good enough?
    if(in < width) {
      return in;
    }
    // otherwise, search for whitespace
    int iw = s.lastIndexOf(' ', width);
    // good whitespace found?
    if(iw >= 0 && iw < width) {
      return iw;
    }
    // sub-optimal splitpoint - retry AFTER the given position
    int bp = nextPosition(s.indexOf(' ', width), s.indexOf(NEWLINE, width));
    if(bp >= 0) {
      return bp;
    }
    // even worse - can't split!
    return s.length();
  }
1035219
def _choose_split_points(cls, sorted_keys, shard_count):
    """"""
    assert len(sorted_keys) >= shard_count
    index_stride = len(sorted_keys) / float(shard_count)
    return [sorted_keys[int(round(index_stride * i))]
            for i in range(1, shard_count)]
237847
public static void split2(InterleavedF32 interleaved , GrayF32 band0 , GrayF32 band1 ) {
		if( interleaved.numBands != 2 )
			throw new IllegalArgumentException("Input interleaved image must have 2 bands");
		InputSanityCheck.checkSameShape(band0, interleaved);
		InputSanityCheck.checkSameShape(band1, interleaved);

		for( int y = 0; y < interleaved.height; y++ ) {

			int indexTran = interleaved.startIndex + y*interleaved.stride;
			int indexReal = band0.startIndex + y*band0.stride;
			int indexImg = band1.startIndex + y*band1.stride;

			for( int x = 0; x < interleaved.width; x++, indexTran += 2 ) {

				band0.data[indexReal++] = interleaved.data[indexTran];
				band1.data[indexImg++] = interleaved.data[indexTran+1];
			}
		}
	}