cutPoints(X, binNum, [freq])


X is a vector.

binNum is the number of buckets to be formed.

freq is a vector with the same size as X. It is the frequency for each element in X. If the optional parameter freq is specified, all the elements in X must be unique and sorted in ascending order.


Return a vector with (binNum+1) elements such that the elements of X are evenly distributed within each of the binNum buckets indicated by the vector. Each bucket is defined by two adjacent elements of the vector. The lower bound is inclusive and the upper bound is exclusive.

The function can be used to get the partition scheme of a range domain in a distributed database.


$ cutPoints(2 3 1 4, 2);

$ cutPoints(1 2 3 4, 2, 1 1 1 3);