Commit dce58040 authored by Martin Reinecke's avatar Martin Reinecke

fix field.vdot

parent 89e27a11
Pipeline #14736 passed with stage
in 8 minutes and 40 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