Commit 96e392be authored by Philipp Arras's avatar Philipp Arras
Browse files

Support Operator.vdot(Field)

parent 11e62c4e
Pipeline #70441 failed with stages
in 20 minutes and 5 seconds
......@@ -71,7 +71,16 @@ class Operator(metaclass=NiftyMeta):
return ContractionOperator(self.target, spaces)(self)
def vdot(self, other):
return (self.conjugate()*other).sum()
from ..field import Field
from ..multi_field import MultiField
from ..sugar import makeOp
if isinstance(other, Operator):
res = self.conjugate()*other
elif isinstance(other, (Field, MultiField)):
res = makeOp(other) @ self.conjugate()
else:
raise TypeError
return res.sum()
@property
def real(self):
......
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