Commit f286a57f authored by Theo Steininger's avatar Theo Steininger

Merge branch 'fix_vdot' into 'master'

fix field.vdot

See merge request !160
parents 89e27a11 dce58040
Pipeline #14738 passed with stages
in 12 minutes and 27 seconds
......@@ -1073,7 +1073,7 @@ class Field(Loggable, Versionable, object):
if spaces is None:
x_val = x.get_val(copy=False)
y_val = y.get_val(copy=False)
result = (x_val.conjugate() * y_val).sum()
result = (y_val.conjugate() * x_val).sum()
return result
else:
# create a diagonal operator which is capable of taking care of the
......
......@@ -119,3 +119,12 @@ class Test_Functionality(unittest.TestCase):
assert_allclose(ps2.val.get_full_data()/samples,
fp2.val.get_full_data(),
rtol=0.1)
def test_vdot(self):
s=RGSpace((10,))
f1=Field.from_random("normal",domain=s,dtype=np.complex128)
f2=Field.from_random("normal",domain=s,dtype=np.complex128)
assert_allclose(f1.vdot(f2),f1.vdot(f2,spaces=0))
assert_allclose(f1.vdot(f2),np.conj(f2.vdot(f1)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment