FFT inside integral

When we consider the unit square [0,1]^2. We can compute the FFT of a P1 function u by using dfft(u[ ], nx, -1).

I would like to know if it is somehow possible to use this trick inside an integral so to express something like

varf a(u,v) = int(Th)(eigenValues [].* dfft(u[ ]) .* ddft(v[ ])) ;

This would permit me to solve the following variational formula

where Ae is a diagonal operator for the Fourier Basis and so using fft allows us to construct the associated matrix quickly.

I have thought about creating a function that goes from finite element space to finite element space. So for example, something like this

func Vh Ae ( Vh u, Vh v){
u[ ] = eigenValueVector[ ] .* dfft(u [ ]);
v[ ] = dfft(v[ ] );
return (u*v);
}

But It doesn’t seem to work.

The problem is generally the matrix corresponding to the fourier mode is full in no fourier cas

so the matrix A associe to “a” is full, it is very bad to solve the problem, but you can solve a problem with bilinear form a , without construction the matrix A only the operator A*u with CG or GMRES algorithm.

Yes, I agree that the matrix is full. The problem is that Ae is really expensive to compute otherwise. In reality Ae is a Dirichlet-to-Neumann operator that has to be solved in 3D. This means that for each iteration of my scheme I would need to solve a 3D problem. Moreover, this way is less accurate.

That is why it is preferable to have a full 2D matrix but atleast I don’t lose that much acurracy and I don’t have to deal with huge meshes.

So if you have just to solve a problem with this matrix , so build the linear operator and use a
a GMRES or CG to solve the linear problem,