Returns a matrix containing each possible combination of one entry from vectors of the lengths provided.
Usage
combinations(p)
powerSetMat(n)
Arguments
p
vector of non-negative integers.
n
non-negative integer.
Value
A matrix with number of columns equal to the length of p, and number of
rows equal to $p_1 \times \cdots \times p_k$, each row
corresponding to a different combination. Ordering is reverse-lexographic.
Details
Returns a matrix, each row being one possible combination of integers from the vectors $(0, 1, \ldots, p_i-1)$, for $i$ between 1 and length(p).
Based on bincombinations from package e1071, which provides the binary case.
powerSetMat is just a wrapper for combinations(rep(2, n)).