Skip to content

Instantly share code, notes, and snippets.

View LucasSeveryn's full-sized avatar

Lucas Severyn LucasSeveryn

  • Production, Distribution
  • London
View GitHub Profile
public double p(double v, Attribute a) {
double var = a.getVar();
if (var == 0)
return 1;
double m = a.getM();
double p = ((1 / (Math.sqrt(2 * Math.PI * var)) * Math.exp(-(Math.pow(v
- m, 2))
/ (2 * var))));
return p;
class CMatrix {
double[][] mat;
int d;
CMatrix(int d, int type) {
mat = new double[d][d];
this.d = d;
for (int i = 0; i < d; i++) {
for (int j = 0; j < d; j++) {
this.set(i, j, getCovariance(i, j, type));