numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns
bmat(obj, ldict=None, gdict=None)

Parameters

obj : str or array_like

Input data. If a string, variables in the current scope may be referenced by name.

ldict : dict, optional

A dictionary that replaces local operands in current frame. Ignored if :None:None:`obj` is not a string or :None:None:`gdict` is None.

gdict : dict, optional

A dictionary that replaces global operands in current frame. Ignored if :None:None:`obj` is not a string.

Returns

out : matrix

Returns a matrix object, which is a specialized 2-D array.

Build a matrix object from a string, nested sequence, or array.

See Also

block

A generalization of this function for N-d arrays, that returns normal ndarrays.

Examples

>>> 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]])
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/matrixlib/defmatrix.py#1035
type: <class 'function'>
Commit: