Accord.Tests.Interop.Math.LbfgsbComparer.Expected C# (CSharp) Method

Expected() public method

public Expected ( Specification problem ) : Info[]
problem Specification
return Info[]
        public Info[] Expected(Specification problem)
        {
            NativeCode = String.Empty;

            Function function = problem.Function.Invoke;
            Gradient gradient = problem.Gradient.Invoke;

            if (l == null)
            {
                l = new double[problem.Start.Length];
                for (int i = 0; i < l.Length; i++)
                    l[i] = Double.NegativeInfinity;
            }

            if (u == null)
            {
                u = new double[problem.Start.Length];
                for (int i = 0; i < l.Length; i++)
                    u[i] = Double.PositiveInfinity;
            }

            Param2 param = new Param2()
            {
                factr = factr,
                l = l,
                u = u,
                pgtol = pgtol,
                m = m,
                max_iterations = max_iterations
            };

            NativeCode = Wrapper.Lbfgsb3((double[])problem.Start.Clone(), function, gradient, param).Trim();

            return Wrapper.list.ToArray();
        }

Usage Example

        public void DefaultBatchTest()
        {
            foreach (var problem in problems)
            {
                LbfgsbComparer cmp = new LbfgsbComparer();

                var expected = cmp.Expected(problem);
                var actual   = cmp.Actual(problem);

                check(actual, expected);
            }
        }
All Usage Examples Of Accord.Tests.Interop.Math.LbfgsbComparer::Expected