Cureos.Numerics.Nlp.S225.eval_jac_g C# (CSharp) Method

eval_jac_g() public method

public eval_jac_g ( int n, double x, bool new_x, int m, int nele_jac, int iRow, int jCol, double values ) : bool
n int
x double
new_x bool
m int
nele_jac int
iRow int
jCol int
values double
return bool
        public override bool eval_jac_g(int n, double[] x, bool new_x, int m, int nele_jac, int[] iRow, int[] jCol, double[] values)
        {
            if (values == null)
            {
                /* set the structure of the jacobian */
                /* this particular jacobian is dense */

                iRow[0] = 0;
                jCol[0] = 0;
                iRow[1] = 0;
                jCol[1] = 1;
                iRow[2] = 1;
                jCol[2] = 0;
                iRow[3] = 1;
                jCol[3] = 1;
                iRow[4] = 2;
                jCol[4] = 0;
                iRow[5] = 2;
                jCol[5] = 1;
                iRow[6] = 3;
                jCol[6] = 0;
                iRow[7] = 3;
                jCol[7] = 1;
                iRow[8] = 4;
                jCol[8] = 0;
                iRow[9] = 4;
                jCol[9] = 1;
            }
            else
            {
                /* return the values of the jacobian of the constraints */

                values[0] = 1.0;
                values[1] = 1.0;
                values[2] = 2.0 * x[0];
                values[3] = 2.0 * x[1];
                values[4] = 18.0 * x[0];
                values[5] = 2.0 * x[1];
                values[6] = 2.0 * x[0];
                values[7] = -1.0;
                values[8] = -1.0;
                values[9] = 2.0 * x[0];
            }

            return true;
        }