public double dotProduct(DynamiceBNCompoundVector vec) { if (vec.size() != this.size()) throw new IllegalArgumentException("Error in variable Vector. Method copy. The parameter vec has a different size. "); double sum = 0; sum += this.getIndicatorTime0()*vec.getIndicatorTime0(); sum += this.getIndicatorTimeT()*vec.getIndicatorTimeT(); if (this.vectorTime0!=null && vec.getVectorTime0()!=null) sum += this.vectorTime0.dotProduct(vec.getVectorTime0()); if (this.vectorTimeT!=null && vec.getVectorTimeT()!=null) sum += this.vectorTimeT.dotProduct(vec.getVectorTimeT()); return sum; }
public void copy(DynamiceBNCompoundVector vector) { if (vector.size() != this.size()) throw new IllegalArgumentException("Error in variable Vector. Method copy. The parameter vec has a different size. "); this.setIndicatorTime0(vector.getIndicatorTime0()); this.setIndicatorTimeT(vector.getIndicatorTimeT()); if (this.vectorTime0==null) this.vectorTime0=vector.getVectorTime0(); else if (vector.getVectorTime0()==null) this.vectorTime0=null; else this.vectorTime0.copy(vector.getVectorTime0()); if (this.vectorTimeT==null) this.vectorTimeT=vector.getVectorTimeT(); else if (vector.getVectorTimeT()==null) this.vectorTimeT=null; else this.vectorTimeT.copy(vector.getVectorTimeT()); }
public void sum(DynamiceBNCompoundVector vector) { if (vector.size() != this.size()) throw new IllegalArgumentException("Error in variable Vector. Method copy. The parameter vec has a different size. "); this.setIndicatorTime0(this.getIndicatorTime0() + vector.getIndicatorTime0()); this.setIndicatorTimeT(this.getIndicatorTimeT() + vector.getIndicatorTimeT()); if (this.vectorTime0==null) this.vectorTime0=vector.getVectorTime0(); else if (vector.getVectorTime0()!=null) this.vectorTime0.sum(vector.getVectorTime0()); if (this.vectorTimeT==null) this.vectorTimeT=vector.getVectorTimeT(); else if (vector.getVectorTimeT()!=null) this.vectorTimeT.sum(vector.getVectorTimeT()); } }
newPrior.getVectorByPosition(i).multiplyBy(1 - lambda[i]); newPosterior.getVectorByPosition(i).multiplyBy(lambda[i]);
/** * {@inheritDoc} */ @Override public void updateNaturalFromMomentParameters() { DynamiceBNCompoundVector globalMomentsParam = (DynamiceBNCompoundVector)this.momentParameters; DynamiceBNCompoundVector vectorNatural = this.createEmtpyCompoundVector(); globalMomentsParam.getVectorTime0().divideBy(globalMomentsParam.getIndicatorTime0()); globalMomentsParam.getVectorTimeT().divideBy(globalMomentsParam.getIndicatorTimeT()); this.bayesianNetworkTime0.setMomentParameters((MomentParameters)globalMomentsParam.getVectorTime0()); this.bayesianNetworkTimeT.setMomentParameters((MomentParameters)globalMomentsParam.getVectorTimeT()); vectorNatural.setVectorTime0(this.bayesianNetworkTime0.getNaturalParameters()); vectorNatural.setVectorTimeT(this.bayesianNetworkTimeT.getNaturalParameters()); this.naturalParameters=vectorNatural; }