Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tmcclintock/covariance_breakdown

A small package to breakdown a covariance matrix into constituent parts useful for building emulators.
https://github.com/tmcclintock/covariance_breakdown

Last synced: 26 days ago
JSON representation

A small package to breakdown a covariance matrix into constituent parts useful for building emulators.

Awesome Lists containing this project

README

        

# covariance_breakdown

Constructing emulators of covariance matrices requires first breaking the matrix down into its constituent parts using a decomposition, and then rearranging diagonal and lower triangular data into a more useful form. This is a small package to do that.

Specifically, this packages takes in a covariance matrix, tests that it _can_ be decomposed, performs generalised Cholesky decomposition, and saves:
- the lower triangular matrix `L`
- the diagonal of the GCD `D` (which is in L)
- the flattened independent elements of L that aren't in D, `Lprime`

Additionally, the `breakdown` tool can reconstruct a covariance (and all the other parts) from `D` and `Lprime`.

## Usage

```python
#Given a covariance matrix C

from covariance_breakdown import *

C_breakdown = breakdown(C)

C_attr = C_breakdown.C #saves C as an attribute
D = C_breakdown.D
L = C_breakdown.L
Lprime = C_breakdown.Lprime

C_breakdown2 = breakdown.from_D_Lprime(D, Lprime)
#Has all the same attributes as C_breakdown
```