|
3 | 3 | __all__ = ['matrix', 'bmat', 'mat', 'asmatrix']
|
4 | 4 |
|
5 | 5 | import sys
|
| 6 | +import warnings |
6 | 7 | import ast
|
7 | 8 | import numpy.core.numeric as N
|
8 | 9 | from numpy.core.numeric import concatenate, isscalar
|
@@ -70,6 +71,10 @@ class matrix(N.ndarray):
|
70 | 71 | """
|
71 | 72 | matrix(data, dtype=None, copy=True)
|
72 | 73 |
|
| 74 | + .. note:: It is no longer recommended to use this class, even for linear |
| 75 | + algebra. Instead use regular arrays. The class may be removed |
| 76 | + in the future. |
| 77 | +
|
73 | 78 | Returns a matrix from an array-like object, or from a string of data.
|
74 | 79 | A matrix is a specialized 2-D array that retains its 2-D nature
|
75 | 80 | through operations. It has certain special operators, such as ``*``
|
@@ -105,6 +110,12 @@ class matrix(N.ndarray):
|
105 | 110 | """
|
106 | 111 | __array_priority__ = 10.0
|
107 | 112 | def __new__(subtype, data, dtype=None, copy=True):
|
| 113 | + warnings.warn('the matrix subclass is not the recommended way to ' |
| 114 | + 'represent matrices or deal with linear algebra (see ' |
| 115 | + 'https://docs.scipy.org/doc/numpy/user/' |
| 116 | + 'numpy-for-matlab-users.html). ' |
| 117 | + 'Please adjust your code to use regular ndarray.', |
| 118 | + PendingDeprecationWarning, stacklevel=2) |
108 | 119 | if isinstance(data, matrix):
|
109 | 120 | dtype2 = data.dtype
|
110 | 121 | if (dtype is None):
|
|
0 commit comments