mirror of
https://github.com/fjosw/pyerrors.git
synced 2025-03-15 06:40:24 +01:00
complex real matrix mutliplication speed up
This commit is contained in:
parent
7efe9612bc
commit
f4abad1280
2 changed files with 3 additions and 4 deletions
|
@ -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)
|
||||
|
@ -109,4 +108,4 @@ def read_ExternalLeg_hd5(path, filestem, ens_id, order='F'):
|
|||
matrix[si, sj, ci, cj] = CObs(real, imag)
|
||||
matrix[si, sj, ci, cj].gamma_method()
|
||||
|
||||
return Npr_matrix(matrix.swapaxes(1, 2).reshape((12,12), order=order), mom_in=mom)
|
||||
return Npr_matrix(matrix.swapaxes(1, 2).reshape((12, 12), order=order), mom_in=mom)
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue