mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-16 15:20:24 +01:00
feat: method is_matrix_symmetric added.
This commit is contained in:
parent
6c6a0f367e
commit
b56c4e7694
1 changed files with 11 additions and 0 deletions
|
@ -237,6 +237,17 @@ class Corr:
|
||||||
raise Exception("Corr could not be symmetrized: No redundant values")
|
raise Exception("Corr could not be symmetrized: No redundant values")
|
||||||
return Corr(newcontent, prange=self.prange)
|
return Corr(newcontent, prange=self.prange)
|
||||||
|
|
||||||
|
def is_matrix_symmetric(self):
|
||||||
|
"""Checks whether a correlator matrices is symmetric on every timeslice."""
|
||||||
|
if self.N == 1:
|
||||||
|
raise Exception("Only works for correlator matrices.")
|
||||||
|
for t in range(self.T):
|
||||||
|
for i in range(self.N):
|
||||||
|
for j in range(i + 1, self.N):
|
||||||
|
if hash(self[t][i, j]) != hash(self[t][j, i]):
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|
||||||
def matrix_symmetric(self):
|
def matrix_symmetric(self):
|
||||||
"""Symmetrizes the correlator matrices on every timeslice."""
|
"""Symmetrizes the correlator matrices on every timeslice."""
|
||||||
if self.N > 1:
|
if self.N > 1:
|
||||||
|
|
Loading…
Add table
Reference in a new issue