Commit 39c23ea0 authored by Maria Dimashova's avatar Maria Dimashova

replaced using cv::exp

parent 6367867c
...@@ -503,8 +503,11 @@ void EM::computeProbabilities(const Mat& sample, int& label, Mat* probs, double* ...@@ -503,8 +503,11 @@ void EM::computeProbabilities(const Mat& sample, int& label, Mat* probs, double*
return; return;
Mat buf, *sampleProbs = probs ? probs : &buf; Mat buf, *sampleProbs = probs ? probs : &buf;
Mat expL_Lmax; Mat expL_Lmax(L.size(), CV_64FC1);
exp(L - L.at<double>(label), expL_Lmax); double maxLVal = L.at<double>(label);
for(int i = 0; i < L.cols; i++)
expL_Lmax.at<double>(i) = std::exp(L.at<double>(i) - maxLVal);
double partSum = 0, // sum_j!=q (exp(L_ij - L_iq)) double partSum = 0, // sum_j!=q (exp(L_ij - L_iq))
factor; // 1/(1 + partExpSum) factor; // 1/(1 + partExpSum)
for(int clusterIndex = 0; clusterIndex < nclusters; clusterIndex++) for(int clusterIndex = 0; clusterIndex < nclusters; clusterIndex++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment