def _bstar_set(beta, alpha, yTBy, yTBX, yTBM, XTBX, XTBM, MTBM):
    """
    Compute -2𝐲ᵀBEⱼ𝐛ⱼ + (𝐛ⱼEⱼ)ᵀBEⱼ𝐛ⱼ.

    For 𝐛ⱼ = [𝜷ⱼᵀ 𝜶ⱼᵀ]ᵀ.
    """
    from numpy_sugar import epsilon

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

    For 𝐛ⱼ = [𝜷ⱼᵀ 𝜶ⱼᵀ]ᵀ.
    """
    from numpy_sugar import epsilon

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

    For 𝐛ⱼ = [𝜷ⱼᵀ 𝜶ⱼᵀ]ᵀ.
Compute - 2𝐲ᵀBEⱼ𝐛ⱼ + ( 𝐛ⱼEⱼ ) ᵀBEⱼ𝐛ⱼ .