Hello,

Is it possible to compute a matrix scalar product in FreeFEM without creating an additional real[int] variable?

I would like to evaluate quantities like `int2d(Th)(grad(u)'*grad(u))`

using the matrix formulation ` u[]'*A*u[]`

. It is perfectly possible to create a `real[int]`

for `A*u[]`

and then compute the scalar product. I was just wondering if there is a direct way.

On the other hand, I want to optimize the computation of some integrals (I have a big loop of size n^2 and I compute integrals at every iteration) and I have some questions:

- Is it better to create one integral containing everything then to have multiple integrals?
- Functions that live in different finite element spaces (P0,P1) should be put into separate integrals? If they are put in the same integral then they are interpolated on the same FE space before the integration?
- Mixing quantities depending on dx(u) and u in the same integral will slow things down? For example, when integrating dx(u), the derivation is computed every time it occurs in the code? Is it worth saving this into a variable?

Thank you for your answers.

Best regards,

Beniamin