The main idea:
\(h(\cdot)\) is \(Z\) homogeneous if \(h(Diag(Z\gamma)x) = G(\gamma)h(x)\), where
\(G\) is a diagonal matrix with \(\gamma\) elements raised to some power.
As a check, if \(h(\cdot)\) is homogeneous then
$$h(Diag(Z\gamma) x_{1}) / h(Diag(Z\gamma) x_{2}) = h(x_{1}) / h(x_{2});$$
That is, $$\texttt{diff} = h(Diag(Z\gamma) x_{1}) h(x_{2}) - h(Diag(Z\gamma) x_{2}) h(x_{1}) = 0.$$ Here, the division and multiplication are taken element-wise.
This program randomly generates gamma, x1, and x2, and
computes norm(diff). It returns a warning if norm(diff) is
too far from \(0\).