This does not seem correct. *
on arrays is equivalent to a cwiseProduct
while you want a matrix product with W'
. Proposition:
Eigen::MatrixXf j = (W.transpose() * (R.array().pow(beta-2)*V.array()).matrix());
Eigen::MatrixXf k = (W.transpose() * R.array().pow(beta-1).matrix());
H = H.cwiseProduct(j/max(k.maxCoeff(),myeps));