pairwise_combination_indices: Compute all pairwise combinations of indices
Description
Fast computation of indices of all pairwise element of a vector of length n.
Usage
pairwise_combination_indices(n, self = FALSE)
Value
A matrix with n*(n+1)/2 rows (if self=TRUE) or n*(n-1)/2 rows (if self=FALSE, the default) and two columns gicing all possible combinations of indices.
Arguments
n
A number giving the number of elements to create all pairwise indices from
self
A logical that determines whether a column should also be multiplied by itself.
Author
Claus Ekstrom <claus@rprimer.dk>
Details
Note that the output order of columns corresponds to the order of the columns in x. First column 1 is multiplied with each of the other columns, then column 2 with the remaining columns etc.