numpy.asmatrix(data,dtype=None)[source]¶Interpret the input as a matrix.
Unlikematrix,asmatrix does not make a copy if the input is alreadya matrix or an ndarray. Equivalent tomatrix(data,copy=False).
| Parameters: |
|
|---|---|
| Returns: |
|
Examples
>>>x=np.array([[1,2],[3,4]])
>>>m=np.asmatrix(x)
>>>x[0,0]=5
>>>mmatrix([[5, 2], [3, 4]])