-
Notifications
You must be signed in to change notification settings - Fork 0
/
MassGaussianNode.h
executable file
·67 lines (51 loc) · 1.7 KB
/
MassGaussianNode.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
#ifndef MASSGAUSSIANNODE_H_
#define MASSGAUSSIANNODE_H_
#include "nfx.h"
#include "EXandX2.h"
#include "EXandLnX.h"
#include "Node.h"
#include <math.h>
namespace model {
class MassGaussianNode: public Node {
private:
// Member variables for defining the prior and size of the array represented
EXandX2* mean;
EXandLnX* precision;
int dim1, dim2;
// Moments store
double*** moments;
public:
// Constructor and Destructor
MassGaussianNode(int size1, int size2, EXandX2* mean, EXandLnX* precision);
~MassGaussianNode();
// Functions to update parents
void updateMeanParent();
void updatePrecisionParent();
// Accessors for moments
double* getMoments(int inOne, int inTwo);
double getEX(int pos1, int pos2);
double getEX2(int pos1, int pos2);
// Accessors for mean and precision
EXandX2* getMean();
EXandLnX* getPrecision();
// Function to get the vital statistics of the distribution
void getVitalStatistics(double &xiPrior11, double &xiPrior12,
double &xiPrior21, double &xiPrior22, double &xiMean,
double &xiVarOfMean, double &xiAverageVariance);
// Functions inherited from Node
double getBound();
virtual void IO(string description, istream& file, bool loadPriors,
bool debug);
virtual void IO(string description, ostream& file, bool loadPriors,
bool debug);
void update(int index1, int index2, int index3, double message[]);
private:
// Helper functions to get priors, moments and parameters
void updatePrior(double priorParameters[]);
void setMoments(int inOne, int inTwo, double val1, double val2);
void getParams(int inOne, int inTwo, double* params);
// Helper function to randomly initialise the moments array
void initialiseMoments();
};
}
#endif /*MASSGAUSSIANNODE_H_*/