summaryrefslogtreecommitdiff
blob: 1d12e198648ef976c013332944c2015c587975ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- a/svm.cpp
+++ b/svm.cpp
@@ -1282,6 +1282,9 @@
 		int start, j;
 		if((start = cache->get_data(i,&data,len)) < len)
 		{
+#ifdef OPENMP
+#pragma omp parallel for private(j)
+#endif
 			for(j=start;j<len;j++)
 				data[j] = (Qfloat)(y[i]*y[j]*(this->*kernel_function)(i,j));
 		}
@@ -2506,7 +2509,10 @@
 	   model->param.svm_type == NU_SVR)
 	{
 		double *sv_coef = model->sv_coef[0];
-		double sum = 0;
+		double sum = 0; int i;
+#ifdef OPENMP
+#pragma omp parallel for private(i) reduction(+:sum)
+#endif
 		for(i=0;i<model->l;i++)
 			sum += sv_coef[i] * Kernel::k_function(x,model->SV[i],model->param);
 		sum -= model->rho[0];
@@ -2523,6 +2529,9 @@
 		int l = model->l;
 
 		double *kvalue = Malloc(double,l);
+#ifdef OPENMP
+#pragma omp parallel for private(i)
+#endif
 		for(i=0;i<l;i++)
 			kvalue[i] = Kernel::k_function(x,model->SV[i],model->param);