bundles / numpy 2.4.4 / numpy / bmat
function
numpy:bmat
Signature
def bmat ( obj , ldict = None , gdict = None ) Summary
Build a matrix object from a string, nested sequence, or array.
Parameters
obj: str or array_likeInput data. If a string, variables in the current scope may be referenced by name.
ldict: dict, optionalA dictionary that replaces local operands in current frame. Ignored if
objis not a string orgdictis None.gdict: dict, optionalA dictionary that replaces global operands in current frame. Ignored if
objis not a string.
Returns
out: matrixReturns a matrix object, which is a specialized 2-D array.
Examples
import numpy as np A = np.asmatrix('1 1; 1 1') B = np.asmatrix('2 2; 2 2') C = np.asmatrix('3 4; 5 6') D = np.asmatrix('7 8; 9 0')✓
np.bmat([[A, B], [C, D]]) np.bmat(np.r_[np.c_[A, B], np.c_[C, D]]) np.bmat('A,B; C,D')✓
See also
- block
A generalization of this function for N-d arrays, that returns normal ndarrays.
Aliases
-
numpy.bmat