-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmt_paral_job.h
90 lines (74 loc) · 2.19 KB
/
mt_paral_job.h
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef mt_paral_job_h
#define mt_paral_job_h
#include <stdio.h>
#include <math.h>
#include <RcppArmadillo.h>
#include <thread>
#include <mutex>
#include "idrsc2.h"
using namespace std;
using namespace arma;
using namespace Rcpp;
class par_iDRSC2{
public:
field<MATTYPE> Xf;
field<sp_mat> Adjf;
field<sp_mat> Adjf_car;
field<imat> yf;
field<MATTYPE> Mu0;
field<CUBETYPE> Sigma0;
MATTYPE W_int;
MATTYPE Lam0;
CUBETYPE Psi0;
field<VECTYPE> alpha0;
VECTYPE beta0;
VECTYPE beta_grid;
int maxIter_ICM;
int maxIter;
float epsLogLik;
bool verbose;
bool homo;
bool homoClust;
bool Sigma_diag;
bool mix_prop_heter;
bool Sp2;
int maxK, minK;
int g;
int current_idx = 0;
struct Objidrsc2 output[50];
par_iDRSC2(field<MATTYPE>& Xf, field<sp_mat>& Adjf, field<sp_mat>& Adjf_car, field<imat>& yf,
const field<MATTYPE>& Mu0, field<CUBETYPE> Sigma0, const MATTYPE& W_int,
MATTYPE& Lam0, CUBETYPE& Psi0,
const field<VECTYPE>& alpha0, VECTYPE beta0, const VECTYPE& beta_grid,
const int& maxIter_ICM, const int& maxIter, const float& epsLogLik, const bool& verbose,
const bool& homo, const bool& homoClust, const bool& Sigma_diag, const bool& mix_prop_heter, const bool& Sp2,
const int maxK, const int minK){
this->Xf = Xf;
this->Adjf = Adjf;
this->Adjf_car = Adjf_car;
this->yf = yf;
this->Mu0 = Mu0;
this->Sigma0 = Sigma0;
this->W_int = W_int;
this->Lam0 = Lam0;
this->Psi0 = Psi0;
this->alpha0 = alpha0;
this->beta0 = beta0;
this->beta_grid = beta_grid;
this->maxIter_ICM = maxIter_ICM;
this->maxIter = maxIter;
this->epsLogLik = epsLogLik;
this->verbose = verbose;
this->homo = homo;
this->homoClust = homoClust;
this->Sigma_diag = Sigma_diag;
this->mix_prop_heter = mix_prop_heter;
this->Sp2 = Sp2;
this->maxK = maxK;
this->minK = minK;
}
void loop_by_K_idrsc2(int g);
void update_by_thread_idrsc2(int thread_id);
int next_idrsc2();
};
#endif