Browse code

removed C++ parallelization

chakalakka authored on 02/03/2016 10:16:24
Showing 4 changed files

... ...
@@ -117,8 +117,18 @@ clusterByQuality <- function(hmms, G=1:9, itmax=c(100,100), measures=c('spikynes
117 117
 	df <- stats::na.omit(df)
118 118
 	fit <- mclust::Mclust(df, G=G, control=emControl(itmax=itmax))
119 119
 	stopTimedMessage(ptm)
120
-	params <- t(fit$parameters$mean)
121
-	classification <- split(names(fit$classification), fit$classification)
120
+	params <- fit$parameters$mean
121
+	if (is.null(dim(params))) {
122
+		params <- as.matrix(params)
123
+		colnames(params) <- measures
124
+	} else {
125
+		params <- t(params)
126
+	}
127
+	if (is.null(names(fit$classification))) {
128
+		classification <- list(names(hmms))
129
+	} else {
130
+		classification <- split(names(fit$classification), fit$classification)
131
+	}
122 132
 	## Reorder clusters
123 133
 	if (orderBy %in% measures) {
124 134
 		index <- order(params[,orderBy], decreasing=reverseOrder)
... ...
@@ -20,7 +20,7 @@ void R_univariate_hmm(int* O, int* T, int* N, int* state_labels, double* size, d
20 20
 //  	FILELog::ReportingLevel() = FILELog::FromString("DEBUG2");
21 21
 
22 22
 // 	// Parallelization settings
23
-	omp_set_num_threads(*num_threads);
23
+// 	omp_set_num_threads(*num_threads);
24 24
 
25 25
 	// Print some information
26 26
 	//FILE_LOG(logINFO) << "number of states = " << *N;
... ...
@@ -227,7 +227,7 @@ void R_multivariate_hmm(double* D, int* T, int* N, int *Nmod, int* comb_states,
227 227
 //  	FILELog::ReportingLevel() = FILELog::FromString("ERROR");
228 228
 
229 229
 	// Parallelization settings
230
-	omp_set_num_threads(*num_threads);
230
+// 	omp_set_num_threads(*num_threads);
231 231
 
232 232
 	// Print some information
233 233
 	//FILE_LOG(logINFO) << "number of states = " << *N;
... ...
@@ -6,11 +6,11 @@
6 6
 #include "loghmm.h"
7 7
 #include <string> // strcmp
8 8
 
9
-#if defined TARGET_OS_MAC || defined __APPLE__
10
-#include <libiomp/omp.h> // parallelization options on mac
11
-#elif defined __linux__ || defined _WIN32 || defined _WIN64
12
-#include <omp.h> // parallelization options
13
-#endif
9
+// #if defined TARGET_OS_MAC || defined __APPLE__
10
+// #include <libiomp/omp.h> // parallelization options on mac
11
+// #elif defined __linux__ || defined _WIN32 || defined _WIN64
12
+// #include <omp.h> // parallelization options
13
+// #endif
14 14
 
15 15
 // void R_univariate_hmm(int* O, int* T, int* N, int* state_labels, double* size, double* prob, int* maxiter, int* maxtime, double* eps, int* states, double* A, double* proba, double* loglik, double* weights, int* distr_type, double* initial_size, double* initial_prob, double* initial_A, double* initial_proba, bool* use_initial_params, int* num_threads, int* error, int* read_cutoff, int* algorithm);
16 16
 // 
... ...
@@ -12,11 +12,11 @@
12 12
 #include <time.h> // time(), difftime()
13 13
 #include <string> // strcmp
14 14
 
15
-#if defined TARGET_OS_MAC || defined __APPLE__
16
-#include <libiomp/omp.h> // parallelization options on mac
17
-#elif defined __linux__ || defined _WIN32 || defined _WIN64
18
-#include <omp.h> // parallelization options
19
-#endif
15
+// #if defined TARGET_OS_MAC || defined __APPLE__
16
+// #include <libiomp/omp.h> // parallelization options on mac
17
+// #elif defined __linux__ || defined _WIN32 || defined _WIN64
18
+// #include <omp.h> // parallelization options
19
+// #endif
20 20
 
21 21
 class ScaleHMM  {
22 22