I am not sure if this gets hoisted by the compiler, but you may want to have `Qfactors = Q.factors` outside the loops.