Skip to content

Commit 29226d4

Browse files
committed
Scipy: pointer to values in the jacobian can not be free, It belongs to numpy
1 parent a0f2d1f commit 29226d4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

math/scipy/src/ScipyMinimizer.cxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ PyObject *jac_function(PyObject * /*self*/, PyObject *args)
3838

3939
uint size = PyArray_SIZE(arr);
4040
auto params = (double *)PyArray_DATA(arr);
41-
double values[size];
41+
double *values=new double[size];
4242
gGradFunction->Gradient(params, values);
4343
npy_intp dims[1] = {size};
4444
PyObject *py_array = PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE, values);
@@ -74,8 +74,8 @@ void ScipyMinimizer::SetAlgoExtraOptions()
7474
{
7575
std::string type = fOptions.MinimizerAlgorithm();
7676
if (type == "L-BFGS-B") {
77-
fExtraOpts.SetValue("gtol", 1e-10);
78-
fExtraOpts.SetValue("eps", 1.0);
77+
fExtraOpts.SetValue("gtol", 1e-8);
78+
fExtraOpts.SetValue("eps", 0.01);
7979
}
8080
SetExtraOptions(fExtraOpts);
8181
}

0 commit comments

Comments
 (0)