Learn R Programming

simplextree (version 1.0.1)

sub_to_nat: sub_to_nat

Description

Given a combination x, computes its position out of all lexicographically-ordered (n choose 2) combinations.

Usage

sub_to_nat(x, n)

Arguments

x

matrix whose columns represent k-combinations.

n

numerator of the binomial coefficient

Value

integer vector of the positions of the given combinations.

Details

The mapping is done via an lexicographically-ordered combinadic mapping.

References

McCaffrey, J. D. "Generating the mth lexicographical element of a mathematical combination." MSDN Library (2004).