POptUS / IBCDFO

Interpolation-Based Composite Derivative-Free Optimization
Other
7 stars 2 forks source link

Python deprecation warnings #151

Closed jared321 closed 5 months ago

jared321 commented 5 months ago

I see the following warnings in the POUNDERS test output on 145MatlabCI

test_benchmark_pounders (TestPoundersExtensive.TestPounders.test_benchmark_pounders) ... /Users/jared/Projects/POptUS/IBCDFO/ibcdfo_pypkg/.tox/nocoverage/lib/python3.11/site-packages/numpy/matrixlib/defmatrix.py:70: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
  return matrix(data, dtype=dtype, copy=False)

and

/Users/jared/Projects/POptUS/IBCDFO/ibcdfo_pypkg/.tox/nocoverage/lib/python3.11/site-packages/ibcdfo/pounders/pounders.py:230: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  IERR[i] = (c - hF[Mind[i]]) + [D @ (G + 0.5 * H @ D)]
jmlarson1 commented 5 months ago

The first one is an issue with defmatrix, so we'll leave that for numpy to consider fixing.

The second one was a bit annoying to figure out... but it should now be fixed in the 145MatlabCI branch in this commit: https://github.com/POptUS/IBCDFO/pull/146/commits/f5e1e9eade865baf5fd5d1653b94423ff58f05dd

At least, I don't see it here: https://github.com/POptUS/IBCDFO/actions/runs/9697291924/job/26761099351?pr=146

Do you agree @jared321 ? (Thank you for raising this issue!)

jared321 commented 5 months ago

Warnings handled. Closed.