 # How to construct block matrix with assembled matrices

Hi !!
I am working in mixed fem with my space as S = (RT1, CG1, RT1).
SolA = Function(M)
(X, Y, Z) = split(SolA)
nrsides = mesh.num_edges()
nrelems = mesh.num_cells()
The unknowns (X, Y, Z) are obtained from the system of equations ( LHS1_mat ) (SolA) = (RHS1_mat)
where LHS1_mat is a block matrix of size (2nrsides + nrelems, 2nrsides + nrelems).
and RHS1_mat is (2nrsides+nrelems, 1).
X is a vector of size nrsides, Y is nrelems and Z is nrsides, so SolA is 2
nrsides+nrelems.
Now, my matrix M looks like [ A11 A12 0
A21 0 A23
0 0 A33]
where Aij are assembled matrices, say, for example,
Aij = assemble( inner ( div ( bigphi_1) * vphi*dx ) )
and so on.
But, when I am using the following command, I get error.
M = np.block( [[11, A12, np.zeros((nrsides,nrsides))], [A21, np.zeros((nrsidesnrelems)), A23], [np.zeros((nrelems,nrsides)), np.zeros((nrelems, nrelems)), A33]] )
Can anyone help me in this.

## The error is

TypeError Traceback (most recent call last)
in ()
6 pp.t = t
7 b1_1 = assemble(-pp*dot(nn, vbigphi)*ds)
----> 8 LHS1_mat = np.block([[A11, A12, np.zeros((nrsides,nrsides))], [A21, np.zeros((nrsides, nrelems)), A23], [np.zeros((nrelems,nrsides)), np.zeros((nrelems, nrelems)), A33]])
9 RHS1_mat = np.block([[b1_1],[np.zeros((nrelems,1))],[b1_3]])
10 solve(LHS1_mat, Sol_A.vector(), RHS1_mat)

<array_function internals> in block(*args, **kwargs)

4 frames
/usr/local/lib/python3.6/dist-packages/numpy/core/shape_base.py in _block_check_depths_match(arrays, parent_index)
500 first_index, max_arr_ndim, final_size = next(idxs_ndims)
501 for index, ndim, size in idxs_ndims:
–> 502 final_size += size
503 if ndim > max_arr_ndim:
504 max_arr_ndim = ndim

TypeError: unsupported operand type(s) for +=: ‘method’ and ‘method’

Please supply a minimal code example encapsulated with ```, that reproduces your error message

Please format your code such that the indentation is correct, and make sure that you can copy paste the code into a file and then run it. You should use the preview function on discourse to check the formatting