Found some bugs and tested some things, still can't figure out what's causing it to fail.

Bugs found and fixed:

BartlettFactorCpp used d instead of df from input. Now gives same output (average) as the R code.

tested the backsolve inverse (earlier, not now, just worth noting) though there is some instability in that A*(A^-1) has some values at ~x*10^-13, probably irrelevent.

tested that my product of gamma.inv and A.inv was done correctly by extracting one sample (via Rcout) of the 3 values and using R to check that it gave correct result.

Everything else was looked over multiple times.