public void TestPartial() { var bpi = new TExPI("bpi"); AreEqual("(0.5+(0.1*bpi.index:>Single))", DerivDebug(bpi.t, bpi.t.Mul(ExC(0.5f).Add(ExC(0.1f).Mul(bpi.findex))))); var x = VF("x"); var y = VF("y"); AreEqual("(y*2)", DerivDebug(x, y.Mul(2).Mul(x))); }
public static Func <TExArgCtx, TEx <T> > _Fake <T>(Func <TExArgCtx, TEx <T> > target) => gcx => { var fake = new TExPI(); var inner = target(gcx.Append("gcx_bpi", fake, true)); if ((Expression)inner is ConstantExpression) { return(inner); } return(Ex.Block(new ParameterExpression[] { fake }, //This assign is required, else the random id will be recalculated repeatedly! Ex.Assign(fake, gcx.GetByExprType <TExGCX>().bpi), inner )); };