Undocumented
Class | matrix |
matrix(data, dtype=None, copy=True) |
Function | _convert_from_string |
Undocumented |
Function | _from_string |
Undocumented |
Function | asmatrix |
Interpret the input as a matrix. |
Function | bmat |
Build a matrix object from a string, nested sequence, or array. |
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 to matrix(data, copy=False).
data
interpreted as a matrix.
>>> x = np.array([[1, 2], [3, 4]])
>>> m = np.asmatrix(x)
>>> x[0,0] = 5
>>> m matrix([[5, 2], [3, 4]])
Build a matrix object from a string, nested sequence, or array.
obj
is not a string or gdict
is None.obj
is not a string.>>> A = np.mat('1 1; 1 1') >>> B = np.mat('2 2; 2 2') >>> C = np.mat('3 4; 5 6') >>> D = np.mat('7 8; 9 0')
All the following expressions construct the same block matrix:
>>> np.bmat([[A, B], [C, D]]) matrix([[1, 1, 2, 2], [1, 1, 2, 2], [3, 4, 7, 8], [5, 6, 9, 0]]) >>> np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) matrix([[1, 1, 2, 2], [1, 1, 2, 2], [3, 4, 7, 8], [5, 6, 9, 0]]) >>> np.bmat('A,B; C,D') matrix([[1, 1, 2, 2], [1, 1, 2, 2], [3, 4, 7, 8], [5, 6, 9, 0]])