public boolean equals(Object obj) { if (this == obj) { return true; } if ( ! (obj instanceof DoubleAD)) { return false; } DoubleAD b = (DoubleAD) obj; return b.getval() == val && b.getdot() == dot; }
public static DoubleAD exp(DoubleAD a){ DoubleAD c = new DoubleAD(); c.setval( Math.exp(a.getval())); c.setdot(a.getdot() * Math.exp(a.getval())); return c; }
public void minusEquals(DoubleAD a){ setval(val - a.getval() ); setdot(dot - a.getdot() ); }
public void plusEquals(DoubleAD a){ setval(val + a.getval() ); setdot(dot + a.getdot() ); }
public static DoubleAD log(DoubleAD a){ DoubleAD c = new DoubleAD(); c.setval( Math.log(a.getval())); c.setdot( a.getdot()/a.getval()); return c; }
public static DoubleAD divideConst(DoubleAD a, double b){ DoubleAD c = new DoubleAD(); c.setval(a.getval()/b); c.setdot( a.getdot()/b ); return c; }
public static DoubleAD multConst(DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() * b ); c.setdot(a.getdot()*b); return c; }
public static DoubleAD plusConst( DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() + b ); c.setdot( a.getdot()); return c; }
public static DoubleAD minusConst( DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() - b ); c.setdot( a.getdot()); return c; }
int maxIdx = fromIndex; double max = logInputs[fromIndex].getval(); double maxdot = logInputs[fromIndex].getdot(); maxdot = logInputs[i].getdot(); max = logInputs[i].getval(); double curEXP = Math.exp(logInputs[i].getval() - max); intermediate += curEXP; intermediateDot += curEXP*logInputs[i].getdot();
derivativeAD[i].plusEquals(ADMath.multConst(xAD[i], batch.length/(data.length * prior.getSigma()*prior.getSigma()))); derivative[i] = derivativeAD[i].getval(); HdotV[i] = derivativeAD[i].getdot();
public void plusEquals(DoubleAD a){ setval(val + a.getval() ); setdot(dot + a.getdot() ); }
public static DoubleAD log(DoubleAD a){ DoubleAD c = new DoubleAD(); c.setval( Math.log(a.getval())); c.setdot( a.getdot()/a.getval()); return c; }
public static DoubleAD multConst(DoubleAD a,double b){ DoubleAD c = new DoubleAD(); c.setval( a.getval() * b ); c.setdot(a.getdot()*b); return c; }