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(, 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()
raise TypeError
return res.sum()
def real(self):
Supports Markdown
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