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