def _bstar_set(beta, alpha, yTBy, yTBX, yTBM, XTBX, XTBM, MTBM):
from numpy_sugar import epsilon<EOL>r = yTBy<EOL>r -= <NUM_LIT:2> * add.reduce([i @ beta for i in yTBX])<EOL>r -= <NUM_LIT:2> * add.reduce([i @ alpha for i in yTBM])<EOL>r += add.reduce([beta.T @ i @ beta for i in XTBX])<EOL>r += <NUM_LIT:2> * add.reduce([beta.T @ i @ alpha for i in XTBM])<EOL>r += add.reduce([alpha.T @ i @ alpha for i in MTBM])<EOL>return clip(r, epsilon.tiny, inf)<EOL>
Compute -2𝐲ᵀBEⱼ𝐛ⱼ + (𝐛ⱼEⱼ)ᵀBEⱼ𝐛ⱼ.

For 𝐛ⱼ = [𝜷ⱼᵀ 𝜶ⱼᵀ]ᵀ.