POD - compute correlation matrix

Hi everyone,
I’m trying to implement the Proper Orthogonal Decomposition in Fenicsx.
I have collected N_s snapshots u_i in a list. I need to compute the correlation matrix as

C_{ij} = \int_\Omega u_i\cdot u_j\,d\Omega

Then, the eigen-decomposition of this matrix must be performed C\vec{\eta}_n = \lambda_n\vec{\eta}_n to be used in the definition of the basis functions (POD modes) \phi_n

\phi_n(x) = \frac{1}{\sqrt{\lambda_n}}\sum_{k = 1}^{N_s}\eta_{n,k}\cdot u_n(x)

given \eta_{n,k} the k-th component of the n-th eigenvector.

In dolfinx, are there smart ways to do that? I had a look at the GitHub - RBniCS/RBniCSx at 92fc64f6a1493d2321c9e7f7dffe8ef7dadc0859, however I didn’t figure it out a simple way to compute the integral and to find the eigenvalues.

Any help would be helpful,

In RBniCSx the relevant part related to the eigenvalue computation is at RBniCSx/proper_orthogonal_decomposition.py at main · RBniCS/RBniCSx · GitHub

Thank you very much for the quick reply.
The main issue is related to the definition of the correlation matrix. How is the compute_inner_product defined?

I had a look at the repository and to my understanding there are a lot of “dependencies”…

There are definitely dependencies, that’s just how a non trivial library works :slight_smile:

You may want to look at the unit tests, which have a very basic and standalone example at

From there, you will see that compute_inner_product is defined by passing a bilinear form to

and in particular

I would suggest that if you have further questions which are specific to RBniCSx rather than general FEniCSx, it would probably best to discuss them at