Skip to content
Snippets Groups Projects
Commit 574443a8 authored by Theo Steininger's avatar Theo Steininger
Browse files

Merge branch 'tweak_inverse_adjoint' into 'master'

be more concise about adjoint_inverse and inverse_adjoint

See merge request !90
parents 9b85909a f8bc7d00
Branches
No related tags found
2 merge requests!93Master,!90be more concise about adjoint_inverse and inverse_adjoint
Pipeline #
...@@ -86,29 +86,25 @@ class LinearOperator(Loggable, object): ...@@ -86,29 +86,25 @@ class LinearOperator(Loggable, object):
raise raise
return y return y
# If the operator supports inverse() then the inverse adjoint is identical
# to the adjoint inverse. We provide both names for convenience.
def adjoint_inverse_times(self, x, spaces=None, **kwargs): def adjoint_inverse_times(self, x, spaces=None, **kwargs):
spaces = self._check_input_compatibility(x, spaces) spaces = self._check_input_compatibility(x, spaces)
try: try:
y = self._adjoint_inverse_times(x, spaces, **kwargs) y = self._adjoint_inverse_times(x, spaces, **kwargs)
except(NotImplementedError): except(NotImplementedError):
if self.unitary: try:
y = self._times(x, spaces, **kwargs) y = self._inverse_adjoint_times(x, spaces, **kwargs)
else: except(NotImplementedError):
raise if self.unitary:
y = self._times(x, spaces, **kwargs)
else:
raise
return y return y
def inverse_adjoint_times(self, x, spaces=None, **kwargs): def inverse_adjoint_times(self, x, spaces=None, **kwargs):
spaces = self._check_input_compatibility(x, spaces) return adjoint_inverse_times(x, spaces, **kwargs)
try:
y = self._inverse_adjoint_times(x, spaces, **kwargs)
except(NotImplementedError):
if self.unitary:
y = self._times(x, spaces, **kwargs)
else:
raise
return y
def _times(self, x, spaces): def _times(self, x, spaces):
raise NotImplementedError( raise NotImplementedError(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment