Merge branch 'develop' into documentation

This commit is contained in:
fjosw 2022-05-09 13:17:32 +00:00
commit f807fe5727
2 changed files with 8 additions and 3 deletions

View file

@ -279,6 +279,8 @@ class Corr:
sp_vec = sp_vecs[state] sp_vec = sp_vecs[state]
return sp_vec return sp_vec
elif sorted_list in ["Eigenvalue", "Eigenvector"]: elif sorted_list in ["Eigenvalue", "Eigenvector"]:
if sorted_list == "Eigenvalue" and ts is not None:
warnings.warn("ts has no effect when sorting by eigenvalue is chosen.", RuntimeWarning)
all_vecs = [] all_vecs = []
for t in range(self.T): for t in range(self.T):
try: try:

View file

@ -230,8 +230,8 @@ def test_matrix_corr():
corr_mat = pe.Corr(np.array([[corr_aa, corr_ab], [corr_ab, corr_aa]])) corr_mat = pe.Corr(np.array([[corr_aa, corr_ab], [corr_ab, corr_aa]]))
corr_mat.item(0, 0) corr_mat.item(0, 0)
vec_0 = corr_mat.GEVP(0, 0) vec_0 = corr_mat.GEVP(0, 0, sorted_list=None)
vec_1 = corr_mat.GEVP(0, 0, state=1) vec_1 = corr_mat.GEVP(0, 0, state=1, sorted_list=None)
corr_0 = corr_mat.projected(vec_0) corr_0 = corr_mat.projected(vec_0)
corr_1 = corr_mat.projected(vec_1) corr_1 = corr_mat.projected(vec_1)
@ -239,11 +239,14 @@ def test_matrix_corr():
assert np.all([o == 0 for o in corr_0 - corr_aa]) assert np.all([o == 0 for o in corr_0 - corr_aa])
assert np.all([o == 0 for o in corr_1 - corr_aa]) assert np.all([o == 0 for o in corr_1 - corr_aa])
corr_mat.GEVP(0, 0, sorted_list="Eigenvalue") corr_mat.GEVP(0, sorted_list="Eigenvalue")
corr_mat.GEVP(0, 0, sorted_list="Eigenvector") corr_mat.GEVP(0, 0, sorted_list="Eigenvector")
corr_mat.matrix_symmetric() corr_mat.matrix_symmetric()
with pytest.warns(RuntimeWarning):
corr_mat.GEVP(0, 1, sorted_list="Eigenvalue")
with pytest.raises(Exception): with pytest.raises(Exception):
corr_mat.plottable() corr_mat.plottable()