Пример #1
0
        //! compute value of the least square function
        public override double value(Vector x)
        {
            // size of target and function to fit vectors
            Vector target  = new Vector(lsp_.size());
            Vector fct2fit = new Vector(lsp_.size());

            // compute its values
            lsp_.targetAndValue(x, ref target, ref fct2fit);
            // do the difference
            Vector diff = target - fct2fit;

            // and compute the scalar product (square of the norm)
            return(Vector.DotProduct(diff, diff));
        }