-
Notifications
You must be signed in to change notification settings - Fork 1
/
npdf.h
63 lines (56 loc) · 1.68 KB
/
npdf.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
/* npdf.h
* @author Quanli Wang, [email protected]
*/
#pragma once
class NPDF
{
public:
NPDF();
~NPDF(void);
public:
int N,D,T;
int Dpad,PACKpad,Npad,Tpad;
int TRUNKSIZE;
//host variables
float* hX;
float* hMeanAndSigma;
float* hRandomNumber;
int* hComponent;
float* hDensity;
double QQ;
//device variables
float* dX;
float* dMeanAndSigma;
float* dRandomNumber;
int* dComponent;
float* dDensity;
//working variable
void clear();
void getPaddedDim();
bool InitGPU();
bool SetDevice(int device);
bool AllocateHostMemory();
bool GetHostData(double *x);
bool GetHostData(double *pi, double *mu, double *sigma);
bool UpdateWeight(double *pi);
void CopyToGPU(int alldata);
void DoPDF(int islogscale, int backtohost);
bool DoPDFandSample_C(double *Z, double *WWk,NPDF *theother);
bool DoZ(double *Z, double *WWk,NPDF *theother, int transpose);
bool DoZ_max_no_sampling(double *Z, double *WWk,NPDF *theother, int transpose);
void DoSample(int islogscale);
void DoMax();
void NormalizeDensity();
void NormalizeDensity_log();
float SumLog(double *Z4);
float Sum(double *Z4);
void GetRandNumber(double *rn);
void GetRandNumber(curandGenerator_t &rg);
bool DoZ1Z2(double *WWk, NPDF *theother);
bool DoAltQQ(double *WWk, NPDF *theother, double *Z2);
bool DoZ5(double *WWk, NPDF *theother, int what);
void L_inv(double y[], double *logdet, double x[], mwSize m);
void getDensity(float * r);
void getIndicator(float * r);
int iAlignUp(int a, int b);
};