numpy.bmat — NumPy v1.11 Manual (original) (raw)
Build a matrix object from a string, nested sequence, or array.
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')
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]])