mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-15 03:53:41 +02:00
Merge branch 'develop' into documentation
This commit is contained in:
commit
f17e499599
2 changed files with 8 additions and 2 deletions
|
@ -306,12 +306,14 @@ class Corr:
|
|||
else:
|
||||
symmetric_corr = self.matrix_symmetric()
|
||||
|
||||
G0 = np.vectorize(lambda x: x.value)(symmetric_corr[t0])
|
||||
np.linalg.cholesky(G0) # Check if matrix G0 is positive-semidefinite.
|
||||
|
||||
if sort is None:
|
||||
if (ts is None):
|
||||
raise Exception("ts is required if sort=None.")
|
||||
if (self.content[t0] is None) or (self.content[ts] is None):
|
||||
raise Exception("Corr not defined at t0/ts.")
|
||||
G0 = np.vectorize(lambda x: x.value)(symmetric_corr[t0])
|
||||
Gt = np.vectorize(lambda x: x.value)(symmetric_corr[ts])
|
||||
reordered_vecs = _GEVP_solver(Gt, G0)
|
||||
|
||||
|
@ -319,7 +321,6 @@ class Corr:
|
|||
if sort == "Eigenvalue" and ts is not None:
|
||||
warnings.warn("ts has no effect when sorting by eigenvalue is chosen.", RuntimeWarning)
|
||||
all_vecs = [None] * (t0 + 1)
|
||||
G0 = np.vectorize(lambda x: x.value)(symmetric_corr[t0])
|
||||
for t in range(t0 + 1, self.T):
|
||||
try:
|
||||
Gt = np.vectorize(lambda x: x.value)(symmetric_corr[t])
|
||||
|
|
|
@ -310,6 +310,7 @@ def test_GEVP_warnings():
|
|||
with pytest.warns(DeprecationWarning):
|
||||
corr_mat.GEVP(0, sorted_list="Eigenvalue")
|
||||
|
||||
|
||||
def test_GEVP_exceptions():
|
||||
corr_aa = _gen_corr(1)
|
||||
corr_ab = 0.5 * corr_aa
|
||||
|
@ -371,6 +372,10 @@ def test_GEVP_exceptions():
|
|||
with pytest.raises(Exception):
|
||||
corr_0.matrix_symmetric()
|
||||
|
||||
n_corr_mat = -corr_mat
|
||||
with pytest.raises(np.linalg.LinAlgError):
|
||||
n_corr_mat.GEVP(2)
|
||||
|
||||
|
||||
def test_matrix_symmetric():
|
||||
corr_aa = _gen_corr(1)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue