From: Atri Bhattacharya Date: Sat, 2 Jun 2018 14:36:46 +0000 (+0200) Subject: Octave: Use feval instead of do_multi_index_op. X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1fcbcbf2fe8e34234e016cc43a6c41d3e8453e1f;p=nlopt.git Octave: Use feval instead of do_multi_index_op. do_multi_index_op has been dropped from Octave 4.4, with a call to octave::feval being the recommended replacement. See, e.g. https://hg.savannah.gnu.org/hgweb/octave/rev/c6714ae1c06c --- diff --git a/src/octave/nlopt_optimize-oct.cc b/src/octave/nlopt_optimize-oct.cc index 819db4e..04f5fff 100644 --- a/src/octave/nlopt_optimize-oct.cc +++ b/src/octave/nlopt_optimize-oct.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -84,7 +85,12 @@ static double user_function(unsigned n, const double *x, for (unsigned i = 0; i < n; ++i) xm(i) = x[i]; args(0) = xm; - octave_value_list res = data->f->do_multi_index_op(gradient ? 2 : 1, args); + octave_value_list res +#if (OCTAVE_MAJOR_VERSION == 4 && OCTAVE_MINOR_VERSION > 2) + = octave::feval(data->f, args, gradient ? 2 : 1); +#else + = data->f->do_multi_index_op(gradient ? 2 : 1, args); +#endif if (res.length() < (gradient ? 2 : 1)) gripe_user_supplied_eval("nlopt_optimize"); else if (!res(0).is_real_scalar() @@ -121,7 +127,12 @@ static double user_function1(unsigned n, const double *x, for (unsigned i = 0; i < n; ++i) xm(i) = x[i]; args(0) = xm; - octave_value_list res = f->do_multi_index_op(gradient ? 2 : 1, args); + octave_value_list res +#if (OCTAVE_MAJOR_VERSION == 4 && OCTAVE_MINOR_VERSION > 2) + = octave::feval(f, args, gradient ? 2 : 1); +#else + = f->do_multi_index_op(gradient ? 2 : 1, args); +#endif if (res.length() < (gradient ? 2 : 1)) gripe_user_supplied_eval("nlopt_optimize"); else if (!res(0).is_real_scalar()