mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-05-14 19:43:41 +02:00
commit
2a86c059f8
2 changed files with 10 additions and 8 deletions
|
@ -266,9 +266,11 @@ class Corr:
|
||||||
symmetric_corr = self.matrix_symmetric()
|
symmetric_corr = self.matrix_symmetric()
|
||||||
if sorted_list is None:
|
if sorted_list is None:
|
||||||
if (ts is None):
|
if (ts is None):
|
||||||
raise Exception("ts is required if sorted_list=None")
|
raise Exception("ts is required if sorted_list=None.")
|
||||||
|
if (ts <= t0):
|
||||||
|
raise Exception("ts has to be larger than t0.")
|
||||||
if (self.content[t0] is None) or (self.content[ts] is None):
|
if (self.content[t0] is None) or (self.content[ts] is None):
|
||||||
raise Exception("Corr not defined at t0/ts")
|
raise Exception("Corr not defined at t0/ts.")
|
||||||
G0, Gt = np.empty([self.N, self.N], dtype="double"), np.empty([self.N, self.N], dtype="double")
|
G0, Gt = np.empty([self.N, self.N], dtype="double"), np.empty([self.N, self.N], dtype="double")
|
||||||
for i in range(self.N):
|
for i in range(self.N):
|
||||||
for j in range(self.N):
|
for j in range(self.N):
|
||||||
|
@ -281,8 +283,8 @@ class Corr:
|
||||||
elif sorted_list in ["Eigenvalue", "Eigenvector"]:
|
elif sorted_list in ["Eigenvalue", "Eigenvector"]:
|
||||||
if sorted_list == "Eigenvalue" and ts is not None:
|
if sorted_list == "Eigenvalue" and ts is not None:
|
||||||
warnings.warn("ts has no effect when sorting by eigenvalue is chosen.", RuntimeWarning)
|
warnings.warn("ts has no effect when sorting by eigenvalue is chosen.", RuntimeWarning)
|
||||||
all_vecs = []
|
all_vecs = [None] * (t0 + 1)
|
||||||
for t in range(self.T):
|
for t in range(t0 + 1, self.T):
|
||||||
try:
|
try:
|
||||||
G0, Gt = np.empty([self.N, self.N], dtype="double"), np.empty([self.N, self.N], dtype="double")
|
G0, Gt = np.empty([self.N, self.N], dtype="double"), np.empty([self.N, self.N], dtype="double")
|
||||||
for i in range(self.N):
|
for i in range(self.N):
|
||||||
|
@ -302,7 +304,7 @@ class Corr:
|
||||||
if (ts is None):
|
if (ts is None):
|
||||||
raise Exception("ts is required for the Eigenvector sorting method.")
|
raise Exception("ts is required for the Eigenvector sorting method.")
|
||||||
all_vecs = _sort_vectors(all_vecs, ts)
|
all_vecs = _sort_vectors(all_vecs, ts)
|
||||||
all_vecs = [a[state] for a in all_vecs]
|
all_vecs = [a[state] if a is not None else None for a in all_vecs]
|
||||||
else:
|
else:
|
||||||
raise Exception("Unkown value for 'sorted_list'.")
|
raise Exception("Unkown value for 'sorted_list'.")
|
||||||
|
|
||||||
|
|
|
@ -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, sorted_list=None)
|
vec_0 = corr_mat.GEVP(0, 1, sorted_list=None)
|
||||||
vec_1 = corr_mat.GEVP(0, 0, state=1, sorted_list=None)
|
vec_1 = corr_mat.GEVP(0, 1, 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)
|
||||||
|
@ -240,7 +240,7 @@ def test_matrix_corr():
|
||||||
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, sorted_list="Eigenvalue")
|
corr_mat.GEVP(0, sorted_list="Eigenvalue")
|
||||||
corr_mat.GEVP(0, 0, sorted_list="Eigenvector")
|
corr_mat.GEVP(0, 1, sorted_list="Eigenvector")
|
||||||
|
|
||||||
corr_mat.matrix_symmetric()
|
corr_mat.matrix_symmetric()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue