-
numpy.asmatrix(data, dtype=None)
[source] -
Interpret the input as a matrix.
Unlike
matrix
,asmatrix
does not make a copy if the input is already a matrix or an ndarray. Equivalent tomatrix(data, copy=False)
.Parameters: data : array_like
Input data.
dtype : data-type
Data-type of the output matrix.
Returns: mat : matrix
data
interpreted as a matrix.Examples
1>>> x
=
np.array([[
1
,
2
], [
3
,
4
]])
1>>> m
=
np.asmatrix(x)
1>>> x[
0
,
0
]
=
5
123>>> m
matrix([[
5
,
2
],
[
3
,
4
]])
numpy.asmatrix()

2025-01-10 15:47:30
Please login to continue.