-
Notifications
You must be signed in to change notification settings - Fork 177
White noise generators and AR covariance operators #4716
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Jack Betteridge <j.betteridge@imperial.ac.uk>
|
|
Of course, you can just grab the local part of the matrix because it's block diagonal so you don't actually need a parallel Cholesky factor. I've added that PR to the Firedrake meeting agenda this afternoon. |
…iredrakeproject/firedrake into JHopeCollins/moar-covariance-operators
|
|
||
|
|
||
| def diffusion_form(u, v, kappa: Constant | Function, | ||
| formulation: AutoregressiveCovariance.DiffusionForm): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unit test this function.
Depends on #4773 and firedrakeproject/fiat#201.
White and correlated noise generation from #3799, plus extra methods to calculate action and inverse of autoregressive covariance operators and use it for a weighted norm.
White noise generation
See Croci et al 2018.
White noise samples calculating$M^{1/2}z$ where $z_{i}\sim\mathcal{N}(0, I)$ and $M$ is the mass matrix.
$M^{1/2}$ can be constructed by assembling the Cholesky factor of the element-wise mass matrices.
There are two implementations of this:
L2Choleskyclass from Mesh independent optimization trick #4575. There is also a specialisation of this method forVertexOnlyMesh.Autoregressive covariance operator
See Mirouze & Weaver, 2010
A covariance operator$B$ with an
m-th autoregressive function kernel can be calculated usingmBackward Euler steps of a diffusion operator, where the diffusion coefficient is specified by the correlation lengthscale.If$M$ is the mass matrix, $K$ is the matrix for a single Backward Euler step, and $\lambda$ is a normalisation factor, then the m-th order covariance operator with variance $\sigma^2$ is:
This formulation leads to an efficient implementation for$B^{-1}$ (using the action of $K$ ) and for $B^{1/2}$ by taking only m/2 steps of the diffusion operator. This can be used to calculate weighted norms $||x||_{B^{-1}}$ and sample from $\mathcal{N}(0,B)$ .
The
CovarianceOperatorBaseclass provides an abstract interface for other covariance operators, which must implement:sampleto returnapply_action(x)to applyapply_inverse(x)to applynorm(x)to returnPETSc python contexts
If you use the weighted norm$||x||_{B^{-1}}$ in the functional for an adjoint calculation, then often $B$ is a good preconditioner for the 2nd order Hessian. This PR provides a python Mat context and corresponding python PC context for children of
CovarianceOperatorBase.