R/RcppExports.R
pairwise_combination_indices.Rd
Fast computation of indices of all pairwise element of a vector of length n.
pairwise_combination_indices(n, self = FALSE)
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.
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.
pairwise_combination_indices(3)
#> [,1] [,2]
#> [1,] 1 2
#> [2,] 1 3
#> [3,] 2 3
pairwise_combination_indices(4, self=TRUE)
#> [,1] [,2]
#> [1,] 1 1
#> [2,] 1 2
#> [3,] 1 3
#> [4,] 1 4
#> [5,] 2 2
#> [6,] 2 3
#> [7,] 2 4
#> [8,] 3 3
#> [9,] 3 4
#> [10,] 4 4