complex real matrix mutliplication speed up

This commit is contained in:
Fabian Joswig 2021-10-21 11:11:08 +01:00
parent 7efe9612bc
commit f4abad1280
2 changed files with 3 additions and 4 deletions

View file

@ -99,7 +99,6 @@ def read_ExternalLeg_hd5(path, filestem, ens_id, order='F'):
file.close()
corr_data = np.array(corr_data)
rolled_array = np.rollaxis(corr_data, 0, 5)
matrix = np.empty((rolled_array.shape[:-1]), dtype=object)

View file

@ -704,11 +704,11 @@ class CObs:
derived_observable(lambda x, **kwargs: x[2] * x[1] + x[0] * x[3],
[self.real, other.real, self.imag, other.imag],
man_grad=[other.imag.value, self.imag.value, other.real.value, self.real.value]))
elif hasattr(other, 'real') and hasattr(other, 'imag'):
elif hasattr(other, 'real') and getattr(other, 'imag', 0) != 0:
return CObs(self.real * other.real - self.imag * other.imag,
self.imag * other.real + self.real * other.imag)
else:
return CObs(self.real * other, self.imag * other)
return CObs(self.real * np.real(other), self.imag * np.real(other))
def __rmul__(self, other):
return self * other