Commit 49e14ed8 authored by theos's avatar theos
Browse files

Fixed references to paradict in the endomorphic operator.

Moved unitary property to LinearOperator.
parent d57b2f02
......@@ -11,7 +11,7 @@ class EndomorphicOperator(LinearOperator):
# ---Overwritten properties and methods---
def inverse_times(self, x, spaces=None, types=None):
if self.paradict['symmetric'] and self.paradict['unitary']:
if self.symmetric and self.unitary:
return self.times(x, spaces, types)
else:
return super(EndomorphicOperator, self).inverse_times(
......@@ -20,10 +20,8 @@ class EndomorphicOperator(LinearOperator):
types=types)
def adjoint_times(self, x, spaces=None, types=None):
if self.paradict['symmetric']:
if self.symmetric:
return self.times(x, spaces, types)
elif self.paradict['unitary']:
return self.inverse_times(x, spaces, types)
else:
return super(EndomorphicOperator, self).adjoint_times(
x=x,
......@@ -31,10 +29,8 @@ class EndomorphicOperator(LinearOperator):
types=types)
def adjoint_inverse_times(self, x, spaces=None, types=None):
if self.paradict['symmetric']:
if self.symmetric:
return self.inverse_times(x, spaces, types)
elif self.paradict['unitary']:
return self.times(x, spaces, types)
else:
return super(EndomorphicOperator, self).adjoint_inverse_times(
x=x,
......@@ -42,10 +38,8 @@ class EndomorphicOperator(LinearOperator):
types=types)
def inverse_adjoint_times(self, x, spaces=None, types=None):
if self.paradict['symmetric']:
if self.symmetric:
return self.inverse_times(x, spaces, types)
elif self.paradict['unitary']:
return self.times(x, spaces, types)
else:
return super(EndomorphicOperator, self).inverse_adjoint_times(
x=x,
......@@ -68,10 +62,6 @@ class EndomorphicOperator(LinearOperator):
def symmetric(self):
raise NotImplementedError
@abc.abstractproperty
def unitary(self):
raise NotImplementedError
def trace(self):
pass
......
......@@ -60,6 +60,10 @@ class LinearOperator(object):
def implemented(self):
return self._implemented
@abc.abstractproperty
def unitary(self):
raise NotImplementedError
def __call__(self, *args, **kwargs):
return self.times(*args, **kwargs)
......@@ -81,6 +85,9 @@ class LinearOperator(object):
return y
def adjoint_times(self, x, spaces=None, types=None):
if self.unitary:
return self.inverse_times(x, spaces, types)
spaces, types = self._check_input_compatibility(x, spaces, types)
if not self.implemented:
......@@ -89,6 +96,9 @@ class LinearOperator(object):
return y
def adjoint_inverse_times(self, x, spaces=None, types=None):
if self.unitary:
return self.times(x, spaces, types)
spaces, types = self._check_input_compatibility(x, spaces, types)
y = self._adjoint_inverse_times(x, spaces, types)
......@@ -97,6 +107,9 @@ class LinearOperator(object):
return y
def inverse_adjoint_times(self, x, spaces=None, types=None):
if self.unitary:
return self.times(x, spaces, types)
spaces, types = self._check_input_compatibility(x, spaces, types)
y = self._inverse_adjoint_times(x, spaces, types)
......
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