Numpy linalg eigensolver

Hi, I’m working on using numpy library linalg.eig to get the eigenvalue and eigenvector.

I want to use the eigenvalue and eigenvector to solve some variational formulation.

What I want is as follows.

h is the 3x3 tensor element defined as follows.

P3 = fe.TensorElement(‘CG’, fe.triangle, degree = h_deg) # h tensor

P2 = fe.VectorElement(‘CG’, fe.triangle, degree = v_deg) # velocity

P1 = fe.FiniteElement(‘CG’, fe.triangle, degree = p_deg) # pressure

elem = fe.MixedElement([P3, P2, P1])

V = fe.FunctionSpace(mesh, elem)

z = fe.Function(V)

z_ = fe.TrialFunction(V) # used in Jacobian formulation

h, u, p = fe.split(z)

h_T, v, q = fe.TestFunctions(V)

def eigenvecmatrix(h):
q = np.array(h)
w, v = np.linalg.eig(q)
return v

And then, with using the eigenvecmatrix(h), I want to solve the variational formulation.

F_Eq = - fe.div(v) * p * fe.dx
+ fe.inner((eigenvecmatrix(h), fe.nabla_grad(v)) * fe.dx
+ fe.div(u) * q * fe.dx \

This is not really working formulation… but the system is not that simple to input all the information here. Anyway, is there any to convert the h as the numpy array form? The above method says the h is a ListTensor which does not have its subordinate vector… and not can be converted as mentioned method above…

If you have any ideas, I will really appreciate it.