KieranWynn / pyquaternion

A fully featured, pythonic library for representing and using quaternions
http://kieranwynn.github.io/pyquaternion/
MIT License
344 stars 72 forks source link

not use np.matrix to fix PendingDeprecationWarning #67

Open curekoshimizu opened 3 years ago

curekoshimizu commented 3 years ago

Under the followings environment, we can see PendingDeprecationWarning from numpy.

$ pip freeze
numpy==1.20.1
pyquaternion==0.9.9
$ python pyquaternion/test/test_quaternion.py
.....................................................pyquaternion/test/test_quaternion.py:310: 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.
  R = np.matrix(np.eye(3))
.pyquaternion/test/test_quaternion.py:334: 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.
  npm = np.matrix(m)
...............
----------------------------------------------------------------------
Ran 69 tests in 0.112s

OK

So, we should use ndarray instead of numpy.matrix.

ref. https://github.com/numpy/numpy/blob/master/numpy/matrixlib/defmatrix.py#L116-L121