Khatri–Rao product
Khatri–Rao product ⊙ — the column-wise Kronecker product. Spanish: producto Khatri–Rao.
P is (I, R) and Q is (J, R); P ⊙ Q is (I·J, R), and column r is the outer product of P[:, r] and Q[:, r], flattened:
def khatri_rao(P, Q):
return (P[:, None, :] * Q[None, :, :]).reshape(-1, P.shape[1])
It is what turns the tensor equation into the matrix equation a pseudoinverse can solve. And the shortcut (BᵀB) * (CᵀC) — elementwise, R × R — gives (B ⊙ C)ᵀ(B ⊙ C) without forming the tall matrix’s Gram matrix directly, which is why the cost does not blow up.