feat: added support for addition and multiplication of complex numbers (#209)

to Corr objects.
This commit is contained in:
Fabian Joswig 2023-07-21 14:15:41 +01:00 committed by GitHub
parent 01ef97ffdf
commit 7f8c2ce33b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 2 deletions

View file

@ -749,3 +749,13 @@ def test_corr_item():
corr_mat = pe.Corr(np.array([[corr_aa, corr_ab], [corr_ab, corr_aa]]))
corr_mat.item(0, 0)
assert corr_mat[0].item(0, 1) == corr_mat.item(0, 1)[0]
def test_complex_add_and_mul():
o = pe.pseudo_Obs(1.0, 0.3, "my_r345sfg16£$%&$%^%$^$", samples=47)
co = pe.CObs(o, 0.341 * o)
for obs in [o, co]:
cc = pe.Corr([obs for _ in range(4)])
cc += 2j
cc = cc * 4j
cc.real + cc.imag