C#,数值计算——F1dim的计算方法与源程序

using System;

namespace Legalsoft.Truffer
{
    public class F1dim : UniVarRealValueFun
    {
        //public T func;
        //public delegateFuncArray func { get; set; }

        private double[] p { get; set; }
        private double[] xi { get; set; }
        private int n { get; set; }
        private double[] xt { get; set; }
        private RealValueFun func;

        public F1dim(double[] pp, double[] xii, RealValueFun funcc)
        {
            this.p = pp;
            this.xi = xii;
            this.n = pp.Length;
            this.func = funcc;
            this.xt = new double[n];
        }

        public double funk(double x)
        {
            return get(x);
        }

        public double get(double x)
        {
            for (int j = 0; j < n; j++)
            {
                xt[j] = p[j] + x * xi[j];
            }
            return func.funk(xt);
        }
    }
}
 

猜你喜欢

转载自blog.csdn.net/beijinghorn/article/details/132218978