How do I get the diagonal of a Matrix into a numpy array?
For PETSc backend and dolfin matrix A:
diagonal = as_backend_type(A).mat().getDiagonal().array
wrong comment: I found my mistake. It's
.array
and not
.array()