コード例 #1
0
        void ReadFromGridToMatrix(DataGridView dataGrid, out FuncMatrix matrix)
        {
            int cols = dataGrid.Columns.Count;
            int rows = dataGrid.Rows.Count;

            matrix = new FuncMatrix(rows, cols);

            CreateSystem(dataGrid, ref matrix);
        }
コード例 #2
0
        public Problem(int s, double a, double b, Vector u_a, Vector u_b, FuncMatrix p, FuncMatrix q, FuncMatrix f)
        {
            this.s = s;

            this.a = a;
            this.b = b;

            this.u_a = u_a;
            this.u_b = u_b;

            P = p;
            Q = q;

            this.f = f;
        }
コード例 #3
0
        void CreateSystem(DataGridView dataGrid, ref FuncMatrix syst)
        {
            CSharpCodeProvider provider   = new CSharpCodeProvider();
            CompilerParameters parameters = new CompilerParameters();

            parameters.GenerateInMemory = true;
            parameters.ReferencedAssemblies.Add("System.dll");
            CompilerResults results;

            for (int i = 0; i < dataGrid.Rows.Count; i++)
            {
                for (int j = 0; j < dataGrid.Columns.Count; j++)
                {
                    results = provider.CompileAssemblyFromSource(parameters, begin + dataGrid[j, i].Value.ToString() + end);
                    var cls    = results.CompiledAssembly.GetType("MyNamespace.LambdaCreator");
                    var method = cls.GetMethod("Create", BindingFlags.Static | BindingFlags.Public);
                    var del    = (method.Invoke(null, null) as Delegate);
                    syst[i, j] = del;
                }
            }
        }