-
Notifications
You must be signed in to change notification settings - Fork 57
/
beliefs.py
38 lines (32 loc) · 1.28 KB
/
beliefs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Test cases describing different beliefs over quantities of interest of a linear
system."""
import numpy as np
from pytest_cases import case
from probnum import linops, randvars
from probnum.linalg.solvers import beliefs
@case(tags=["sym", "posdef", "square"])
def case_trivial_sym_prior(ncols: int) -> beliefs.LinearSystemBelief:
return beliefs.LinearSystemBelief(
x=randvars.Normal(mean=np.zeros((ncols,)), cov=linops.Identity(ncols)),
Ainv=randvars.Normal(
mean=np.zeros((ncols, ncols)),
cov=linops.SymmetricKronecker(linops.Identity(ncols)),
),
A=randvars.Normal(
mean=np.zeros((ncols, ncols)),
cov=linops.SymmetricKronecker(linops.Identity(ncols)),
),
)
@case(tags=["square"])
def case_trivial_square_prior(ncols: int) -> beliefs.LinearSystemBelief:
return beliefs.LinearSystemBelief(
x=randvars.Normal(mean=np.zeros((ncols,)), cov=linops.Identity(ncols)),
Ainv=randvars.Normal(
mean=np.zeros((ncols, ncols)),
cov=linops.Kronecker(linops.Identity(ncols), linops.Identity(ncols)),
),
A=randvars.Normal(
mean=np.zeros((ncols, ncols)),
cov=linops.Kronecker(linops.Identity(ncols), linops.Identity(ncols)),
),
)