extract_block_diag
- typhon.utils.extract_block_diag(M, n)[source]
- Extract diagonal blocks from square Matrix. - Parameters:
- M (np.array) – Square matrix. 
- n (int) – Number of blocks to extract. 
 
 - Example - >>> foo = np.array([[ 1., 1., 0., 0.], ... [ 1., 1., 0., 0.], ... [ 0., 0., 2., 2.], ... [ 0., 0., 2., 2.]]) >>> extract_block_diag(foo, 2) [array([[ 1., 1.], [ 1., 1.]]), array([[ 2., 2.], [ 2., 2.]])]