H, W, R,V are matrices and are already initialized with respective sizes. "beta" is an int, "myeps" is a float. For the matrix implementation I have currently used Eigen library. However I'm not sure of the syntax to convert this Matlab code successfully to Eigen based C++ code.
Matlab Code
H = H .* ( (W'*(R.^(beta-2) .* V)) ./ max(W'*R.^(beta-1), myeps) );
C++ Code (What I tried so far)
WH = W_ * H_;
Eigen::MatrixXf j=(W_.transpose().array()*(WH.array().pow((beta2)).cwiseProduct(V.array())));
Eigen::MatrixXf k=(W_.transpose().array()*((WH.array().pow(beta-1))));
float m=max(k.maxCoeff(),0.001);
H_ = H_.cwiseProduct(j/m);
Is this code correct?
FYI - This is a step in a NMF Algorithm(Non-negative matrix Factorization based on beta divergence).
Any help would be greatly appreciated.