That's a lot of work for what should just be a simple regression. People have coded this a million times, so... I should just have functions that let me construction a design matrix and then get the t and f stats. In any case, QuantLib does what I want. I have it compiled, and I am satisfied with it.