def blockList2Matrix(l):
 dims = [m.shape[0] for m in l]
 s = sum(dims)
 res = zeros((s, s))
 index = 0
 for i in range(len(l)):
  d = dims[i]
  m = l[i]
  res[index:(index + d), index:(index + d)] = m
  index += d
 return res

def blockList2Matrix ( l ) : dims = [ m . shape [ 0 ] for m in l ] s = sum ( dims ) res = zeros ( ( s , s ) ) index = 0 for i in range ( len ( l ) ) : d = dims [ i ] m = l [ i ] res [ index : ( index + d ) , index : ( index + d ) ] = m index += d return res
converts a list of matrices into a corresponding big block-diagonal one .