Skip to content

[Feature]: Support for decomposition methods in multivariate normal class other than Cholesky #145

Description

@MattScorah

What problem would this solve?

At the moment the multivariate normal class uses the Cholesky decomposition, which fails if collinear vectors are present in the covariance matrix. This is fine for point observations (i.e. gauges), but when performing analysis on gridded data correlations between adjacent pixels may be (close to) perfectly correlated, and Cholesky might fail.

Given that other decomposition methods are already implemented (e.g. SVD), it would be helpful to be able to use them in the multivariate normal class.

What would you like to happen?

Add a parameter where the user can indicate which decomposition method should be used in the multivariate normal class. Arguably Cholesky and SVD are the two most critical options (i.e. a choice between computational speed vs a wider range of supported covariance array structures?)

How important is this to your work?

Nice to have

References or validation sources

An example implementation is Numpy multivariate normal https://github.com/numpy/numpy/blob/main/numpy/random/_generator.pyx line 3719 onward.

However I recognise it's a more laborious issue here because the multivariate normal class has functions for a lot more properties than just generating a random correlated sample, and as it is currently written it is pretty closely tied to Cholesky

Current workaround

I only need the GenerateRandomValues function at the moment, so I have been performing the calculation without the multivariate normal class using SVD.

Affected namespace, class, or method

MultivariateNormal.cs

Examples, screenshots, data, or files

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions