diff --git a/pyerrors/correlators.py b/pyerrors/correlators.py index f2ec27e5..4ad8c582 100644 --- a/pyerrors/correlators.py +++ b/pyerrors/correlators.py @@ -250,9 +250,6 @@ class Corr: if self.N == 1: raise Exception("Trying to symmetrize a smearing matrix, that already has N=1.") - # There are two ways, the GEVP metod can be called. - # 1. return_list=False will return a single eigenvector, normalized according to V*C(t_0)*V=1 - # 2. return_list=True will return a new eigenvector for every timeslice. The time t_s is used to order the vectors according to. arXiv:2004.10472 [hep-lat] def GEVP(self, t0, ts=None, state=0, sorted_list=None): """Solve the general eigenvalue problem on the current correlator @@ -265,7 +262,7 @@ class Corr: If return_list=True and sorting=Eigenvector it gives a reference point for the sorting method. state : int The state one is interested in ordered by energy. The lowest state is zero. - sorted list : string + sorted_list : string if this argument is set, a list of vectors (len=self.T) is returned. If it is left as None, only one vector is returned. "Eigenvalue" - The eigenvector is chosen according to which einvenvalue it belongs individually on every timeslice. "Eigenvector" - Use the method described in arXiv:2004.10472 [hep-lat] to find the set of v(t) belonging to the state. @@ -273,7 +270,7 @@ class Corr: """ if sorted_list is None: if (ts is None): - raise Exception("ts is required if return_list=False") + raise Exception("ts is required if sorted_list=None") if (self.content[t0] is None) or (self.content[ts] is None): 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") diff --git a/tests/correlators_test.py b/tests/correlators_test.py index a2630844..fb91b1b0 100644 --- a/tests/correlators_test.py +++ b/tests/correlators_test.py @@ -167,3 +167,51 @@ def test_utility(): assert np.isclose(o_a[0].value, o_b[0].value) assert np.isclose(o_a[0].dvalue, o_b[0].dvalue) assert np.allclose(o_a[0].deltas['t'], o_b[0].deltas['t']) + + +def test_matrix_corr(): + def _gen_corr(val): + corr_content = [] + for t in range(16): + corr_content.append(pe.pseudo_Obs(val, 0.1, 't', 2000)) + + return pe.correlators.Corr(corr_content) + + corr_aa = _gen_corr(1) + corr_ab = _gen_corr(0.5) + + corr_mat = pe.Corr(np.array([[corr_aa, corr_ab], [corr_ab, corr_aa]])) + corr_mat.smearing(0, 0) + + vec_0 = corr_mat.GEVP(0, 0) + vec_1 = corr_mat.GEVP(0, 0, state=1) + + corr_0 = corr_mat.projected(vec_0) + corr_1 = corr_mat.projected(vec_1) + + assert np.all([o == 0 for o in corr_0 - 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, 0, sorted_list="Eigenvector") + + with pytest.raises(Exception): + corr_mat.plottable() + + with pytest.raises(Exception): + corr_mat.show() + + with pytest.raises(Exception): + corr_mat.m_eff() + + with pytest.raises(Exception): + corr_mat.Hankel() + + with pytest.raises(Exception): + corr_mat.plateau() + + with pytest.raises(Exception): + corr_mat.plateau([2, 4]) + + with pytest.raises(Exception): + corr_o.smearing(0, 0)