polynomial with matrix coefficients
Is there a way in sage to work with polynomials or power series over a ring of matrices? For example, I can write something like:
z=var('z') A=matrix([[z^2+z+1,z],[0,z^2]])
But then lets say I do some transformations and want to recover from the result the matrix coefficient of a particular term. With the matrix above I can write something like
A[0,1].coefficient(z)
or
A[1,0].coefficient(z)
to try to get the individual entries. But what I want is a function that takes A.coefficient(z,2) and returns
[1 0] [0 1]
Is there a way to do this?