calfem-python icon indicating copy to clipboard operation
calfem-python copied to clipboard

np.matrix PendingDeprecationWarning when running Python 3.7.3

Open PeterKanderholm opened this issue 6 years ago • 1 comments

When running calfem on python 3.7.3 I get a deprecation warning for the use of np.matrix

in \calfem\core.py M=np.ravel(C.I*(Gnp.asmatrix(ed).T-np.matrix([0., 0., 0., -qxL2/(2EA), qyL4/(24EI), qyL**3/(6*EI)]).T))
A=np.matrix([M[0],M[3]]).T B=np.matrix([M[1],M[2],M[4],M[5]]).T

C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\calfem\core.py:361: 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.

PeterKanderholm avatar Jul 01 '19 19:07 PeterKanderholm

Apparently NumPy wants to deprecate the matrix-class for good reasons. We will try to update calfem in the coming releases. However, there is currently a lot of code using np.matrix...

Jonas

jonaslindemann avatar Apr 25 '21 21:04 jonaslindemann