public FunctionView3(Functional.Function f, ref Bitmap img) { Func = f; G = Graphics.FromImage(img); G.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality; ScreenCenterX = img.Width / 2; ScreenCenterY = img.Height / 2; }
public Functional.Function StandardAssembler_Sqrt(ref List <string> param, ref List <string> paramexp) { if (paramexp.Count == 1) { string s = paramexp[0]; int cs = Expression.ClassOf(ref s); if (2 <= cs && cs <= 5) { Functional.Function fparam = AssembleFunction(s, ref param); return (delegate(Tensor x) { return MathT.Sqrt(fparam(x)); }); } } throw new Exception("组装Sqrt函数失败:参数个数不合法"); }
/*public Functional.Function StandardAssembler_Average(ref List<string> param, ref List<string> paramexp) * { * //if(param) * }*/ public Functional.Function StandardAssembler_MatrixDet(ref List <string> param, ref List <string> paramexp) { if (paramexp.Count == 1) { string s = paramexp[0]; int cs = Expression.ClassOf(ref s); if (cs == 4) { Functional.Function fparam = AssembleFunction(paramexp[0], ref param); return (delegate(Tensor x) { Tensor ans = fparam(x); return MathT.MatrixDet(ans); }); } } throw new Exception("组装MatrixDet函数失败:参数不合法"); }
public Functional.Function StandardAssembler_Pow(ref List <string> param, ref List <string> paramexp) { if (paramexp.Count == 2) { string s = paramexp[0]; int cs1 = Expression.ClassOf(ref s); s = paramexp[1]; int cs2 = Expression.ClassOf(ref s); if (cs1 >= 2 && cs1 < 6 && cs2 >= 2 && cs2 < 6) { Functional.Function fparam1 = AssembleFunction(paramexp[0], ref param); Functional.Function fparam2 = AssembleFunction(paramexp[1], ref param); return (delegate(Tensor x) { return MathT.Pow(fparam1(x), fparam2(x)); }); } } throw new Exception("组装Pow函数失败:参数不合法"); }
public Functional.Function StandardAssembler_Sqr(ref List <string> param, ref List <string> paramexp) { if (paramexp.Count == 1) { string s = paramexp[0]; int cs = Expression.ClassOf(ref s); if (2 <= cs && cs <= 5) { Functional.Function fparam = AssembleFunction(s, ref param); return (delegate(Tensor x) { Tensor ans = new Tensor(fparam(x)); for (int i = 0; i < ans.Count; i++) { ans.X[i] *= ans.X[i]; } return ans; }); } } throw new Exception("组装Sqr函数失败:参数个数不合法"); }