There is a maintenance of MPCDF Gitlab on Thursday, April 22st 2020, 9:00 am CEST - Expect some service interruptions during this time

Commit 280e2cde authored by theos's avatar theos

Removed domain and target from LinearOperator.__init__

parent 47d8ebc6
......@@ -18,8 +18,8 @@ class DiagonalOperator(EndomorphicOperator):
def __init__(self, domain=(), field_type=(), implemented=True,
diagonal=None, bare=False, copy=True,
distribution_strategy=None):
super(DiagonalOperator, self).__init__(domain=domain,
field_type=field_type)
self._domain = self._parse_domain(domain)
self._field_type = self._parse_field_type(field_type)
self._implemented = bool(implemented)
......@@ -84,6 +84,14 @@ class DiagonalOperator(EndomorphicOperator):
# ---Mandatory properties and methods---
@property
def domain(self):
return self._domain
@property
def field_type(self):
return self._field_type
@property
def implemented(self):
return self._implemented
......
......@@ -35,8 +35,8 @@ class FFTOperator(LinearOperator):
def __init__(self, domain=(), field_type=(), target=None, module=None):
super(FFTOperator, self).__init__(domain=domain,
field_type=field_type)
self._domain = self._parse_domain(domain)
self._field_type = self._parse_field_type(field_type)
# Initialize domain and target
if len(self.domain) != 1:
......@@ -124,10 +124,18 @@ class FFTOperator(LinearOperator):
# ---Mandatory properties and methods---
@property
def domain(self):
return self._domain
@property
def target(self):
return self._target
@property
def field_type(self):
return self._field_type
@property
def field_type_target(self):
return self.field_type
......
......@@ -12,9 +12,8 @@ import nifty.nifty_utilities as utilities
class LinearOperator(object):
__metaclass__ = abc.ABCMeta
def __init__(self, domain=(), field_type=()):
self._domain = self._parse_domain(domain)
self._field_type = self._parse_field_type(field_type)
def __init__(self):
pass
def _parse_domain(self, domain):
if domain is None:
......@@ -45,17 +44,17 @@ class LinearOperator(object):
"ERROR: Given object is not a nifty.FieldType."))
return field_type
@property
@abc.abstractproperty
def domain(self):
return self._domain
raise NotImplementedError
@abc.abstractproperty
def target(self):
raise NotImplementedError
@property
@abc.abstractproperty
def field_type(self):
return self._field_type
raise NotImplementedError
@abc.abstractproperty
def field_type_target(self):
......
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