gen.coefs function

A helper function to generate a d-dimensional linear transformation matrix.