# element-wise generalized eigenvalue problem in X-FEM

[attachment=undefined]eigen_prob.png[/attachment]Hi ngsolve comminity,

I would like to calculate the element-wise eigenvalue k of an generalized eigenvalue problem in the case “CufFEM” or X-FEM.
The problem is stated as:
A[sub]m[/sub] x=k[sub]e,m[/sub]B[sub]m[/sub]x
where the matrix A and B is written as attached figure
[attachment=undefined]eigen_prob.png[/attachment]
Could you give some instruction on implementing this problem, I tried something to calculte the integrator like:

```lsPOS = {"levelset": levelset, "domain_type": POS} lsNEG = {"levelset": levelset, "domain_type": NEG} lsIF = {"levelset": levelset, "domain_type": IF} space_flux = HDiv(mesh, order=2) f = GridFunction(space_flux, "flux") flux = grad(f) #intf = Integrate(lsPOS, mesh=mesh, cf=flux, element_wise=True) intf = Integrate(lsNEG, mesh=mesh, cf=flux, element_wise=True) intf = Integrate(lsIF, mesh=mesh, cf=flux, element_wise=True) intf = Integrate(flux, mesh, VOL, element_wise=True)```
I am not sure if I do this with function Integrate or with symbolic integrators
Then with the computed integrator, How can we calculate the eigenvalue problem? I saw some demos which use the algrhitome like PINVIT?

Hi,

I cannot see the picture, i.e. I don’t know the eigenvalue problem that you want to solve, yet.

Best,
Christoph

[attachment=undefined]eigen_prob.png[/attachment]

Hi Christoph,

Here is the picture

Best,
Shaoqi

Attachment: eigen_prob_2021-05-17.pdf

The integrations are defined on the levelset interface elements and the entire elements respectively.

Thanks Christoph!

Hi Shaoqi,

You should setup the matrices A_m and B_m as you would do for solving a PDE problem. Hence, use symoblic integrators or differential symbols to describe the two bilinear forms and assemble the matrices
Afterwards you can use pinvit as done in the i-tutorials (e.g. 2.4.1) to compute the eigenvalues.

Best,
Christoph