Template Function bats::binom_to_inds

Function Documentation

template<typename T>
inline std::pair<T, T> bats::binom_to_inds(T k, T N)

compute the squareform indices of binomial index k inputs: k, index between 0 and N-choose-2 N size of set returns: (i,j) where i < j

k = N-choose-2 - (N-i)-choose-2 + (j-i-1) (N-i)-choose-2 = N-choose-2 - k - (j-i-1) (N-i)-choose-2 >= N-choose-2 - k