public static float ComputeRegularizedCrossEntropy(SparseMatrix Xt, DenseMatrix Phi, DenseMatrix theta_top, DenseColumnVector b)
{
SparseMatrix TmpSparseMat = new SparseMatrix(Xt);
DenseRowVector TmpDenseRowVec = new DenseRowVector(Xt.nCols);
MatrixOperation.MatrixMultiplyMatrix(TmpSparseMat, Phi, theta_top);
MatrixOperation.Log(TmpSparseMat);
MatrixOperation.ElementwiseMatrixMultiplyMatrix(TmpSparseMat, Xt);
MatrixOperation.VerticalSumMatrix(TmpDenseRowVec, TmpSparseMat);
float CE = (-1.0f) * TmpDenseRowVec.VectorValue.Sum();
DenseMatrix TmpDenseMat = new DenseMatrix(theta_top.nRows, theta_top.nCols);
MatrixOperation.Log(TmpDenseMat, theta_top);
MatrixOperation.bsxfunVectorMultiplyMatrix(TmpDenseMat, b);
MatrixOperation.VerticalSumMatrix(TmpDenseRowVec, TmpDenseMat);
CE = CE - TmpDenseRowVec.VectorValue.Sum();
return CE;
}