Ha! I did this initially using R straight up and even tried to make it reasonably vectorized, but the damn thing took forever and was incredible space-inefficient. Ergo, we are going after it using Rcpp. The genotypes are ordered in rows and columns in the way as described in the paper.

make_matrix_X_l(p, kappa)

Arguments

p

vector of allele frequencies

kappa

a 3-vector of the Cotterman coefficients