public virtual GMMDiag getMarginal(bool[] mask) { int num = 0; int num2 = mask.Length; for (int i = 0; i < num2; i++) { int j = mask[i] ? 1 : 0; if (j != 0) { num++; } } GMMDiag gmmdiag = new GMMDiag(this.getNgauss(), num); num2 = 0; for (int i = 0; i < this.ncoefs; i++) { if (mask[i]) { for (int j = 0; j < this.ngauss; j++) { gmmdiag.setMean(j, num2, this.getMean(j, i)); gmmdiag.setVar(j, num2, this.getVar(j, i)); } num2++; } } for (int i = 0; i < this.ngauss; i++) { gmmdiag.setWeight(i, this.getWeight(i)); } gmmdiag.precomputeDistance(); return(gmmdiag); }
public virtual GMMDiag getGauss(int i) { GMMDiag gmmdiag = new GMMDiag(1, this.getNcoefs()); ByteCodeHelper.arraycopy_primitive_4(this.means[i], 0, gmmdiag.means[0], 0, this.getNcoefs()); ByteCodeHelper.arraycopy_primitive_4(this.covar[i], 0, gmmdiag.covar[0], 0, this.getNcoefs()); gmmdiag.setWeight(0, 1f); gmmdiag.precomputeDistance(); return(gmmdiag); }
public virtual GMMDiag merge(GMMDiag g, float w1) { GMMDiag gmmdiag = new GMMDiag(this.getNgauss() + g.getNgauss(), this.getNcoefs()); for (int i = 0; i < this.getNgauss(); i++) { ByteCodeHelper.arraycopy_primitive_4(this.means[i], 0, gmmdiag.means[i], 0, this.getNcoefs()); ByteCodeHelper.arraycopy_primitive_4(this.covar[i], 0, gmmdiag.covar[i], 0, this.getNcoefs()); gmmdiag.setWeight(i, this.getWeight(i) * w1); } for (int i = 0; i < g.getNgauss(); i++) { ByteCodeHelper.arraycopy_primitive_4(g.means[i], 0, gmmdiag.means[this.ngauss + i], 0, this.getNcoefs()); ByteCodeHelper.arraycopy_primitive_4(g.covar[i], 0, gmmdiag.covar[this.ngauss + i], 0, this.getNcoefs()); gmmdiag.setWeight(this.ngauss + i, g.getWeight(i) * (1f - w1)); } gmmdiag.precomputeDistance(); return(gmmdiag); }