endomorphic_operator.py 1.82 KB
 theos committed Aug 22, 2016 1 2 3 4 5 6 7 8 9 10 11 ``````# -*- coding: utf-8 -*- import abc from nifty.operators.linear_operator import LinearOperator class EndomorphicOperator(LinearOperator): # ---Overwritten properties and methods--- `````` Theo Steininger committed Feb 07, 2017 12 `````` def inverse_times(self, x, spaces=None): `````` theos committed Aug 24, 2016 13 `````` if self.symmetric and self.unitary: `````` Theo Steininger committed Feb 07, 2017 14 `````` return self.times(x, spaces) `````` theos committed Aug 22, 2016 15 16 17 `````` else: return super(EndomorphicOperator, self).inverse_times( x=x, `````` Theo Steininger committed Feb 07, 2017 18 `````` spaces=spaces) `````` theos committed Aug 22, 2016 19 `````` `````` Theo Steininger committed Feb 07, 2017 20 `````` def adjoint_times(self, x, spaces=None): `````` theos committed Aug 24, 2016 21 `````` if self.symmetric: `````` Theo Steininger committed Feb 07, 2017 22 `````` return self.times(x, spaces) `````` theos committed Aug 22, 2016 23 24 25 `````` else: return super(EndomorphicOperator, self).adjoint_times( x=x, `````` Theo Steininger committed Feb 07, 2017 26 `````` spaces=spaces) `````` theos committed Aug 22, 2016 27 `````` `````` Theo Steininger committed Feb 07, 2017 28 `````` def adjoint_inverse_times(self, x, spaces=None): `````` theos committed Aug 24, 2016 29 `````` if self.symmetric: `````` Theo Steininger committed Feb 07, 2017 30 `````` return self.inverse_times(x, spaces) `````` theos committed Aug 22, 2016 31 32 33 `````` else: return super(EndomorphicOperator, self).adjoint_inverse_times( x=x, `````` Theo Steininger committed Feb 07, 2017 34 `````` spaces=spaces) `````` theos committed Aug 22, 2016 35 `````` `````` Theo Steininger committed Feb 07, 2017 36 `````` def inverse_adjoint_times(self, x, spaces=None): `````` theos committed Aug 24, 2016 37 `````` if self.symmetric: `````` Theo Steininger committed Feb 07, 2017 38 `````` return self.inverse_times(x, spaces) `````` theos committed Aug 22, 2016 39 40 41 `````` else: return super(EndomorphicOperator, self).inverse_adjoint_times( x=x, `````` Theo Steininger committed Feb 07, 2017 42 `````` spaces=spaces) `````` theos committed Aug 22, 2016 43 44 45 46 47 48 49 50 51 52 53 54 `````` # ---Mandatory properties and methods--- @property def target(self): return self.domain # ---Added properties and methods--- @abc.abstractproperty def symmetric(self): raise NotImplementedError``````