def __init__(self, map_type, fspace, partition, tspace, linear=False):
        """Initialize a new instance.

        Parameters
        ----------
        map_type : {'sampling', 'interpolation'}
            The type of operator
        fspace : `FunctionSpace`
            The non-discretized (abstract) set of functions to be
            discretized
        partition : `RectPartition`
            Partition of (a subset of) ``fspace.domain`` based on a
            `RectGrid`.
        tspace : `TensorSpace`
            Space providing containers for the values/coefficients of a
            discretized object. Its `TensorSpace.shape` must be equal
            to ``partition.shape``.
        linear : bool, optional
            Create a linear operator if ``True``, otherwise a non-linear
            operator.
        """
        map_type, map_type_in = str(map_type).lower(), map_type
        if map_type not in ('sampling', 'interpolation'):
            raise ValueError('`map_type` {!r} not understood'
                             ''.format(map_type_in))
        if not isinstance(fspace, FunctionSpace):
            raise TypeError('`fspace` {!r} is not a `FunctionSpace` '
                            'instance'.format(fspace))

        if not isinstance(partition, RectPartition):
            raise TypeError('`partition` {!r} is not a `RectPartition` '
                            'instance'.format(partition))
        if not isinstance(tspace, TensorSpace):
            raise TypeError('`tspace` {!r} is not a `TensorSpace` instance'
                            ''.format(tspace))

        if not fspace.domain.contains_set(partition):
            raise ValueError('{} not contained in the domain {} '
                             'of the function set {}'
                             ''.format(partition, fspace.domain, fspace))

        if tspace.shape != partition.shape:
            raise ValueError('`tspace.shape` not equal to `partition.shape`: '
                             '{} != {}'
                             ''.format(tspace.shape, partition.shape))

        domain = fspace if map_type == 'sampling' else tspace
        range = tspace if map_type == 'sampling' else fspace
        super(FunctionSpaceMapping, self).__init__(
            domain, range, linear=linear)
        self.__partition = partition

        if self.is_linear:
            if self.domain.field is None:
                raise TypeError('`fspace.field` cannot be `None` for '
                                '`linear=True`')
            if not is_numeric_dtype(tspace.dtype):
                raise TypeError('`tspace.dtype` must be a numeric data type '
                                'for `linear=True`, got {}'
                                ''.format(dtype_repr(tspace)))
            if fspace.field != tspace.field:
                raise ValueError('`fspace.field` not equal to `tspace.field`: '
                                 '{} != {}'
                                 ''.format(fspace.field, tspace.field))
def __init__ ( self , map_type , fspace , partition , tspace , linear = False ) : map_type , map_type_in = str ( map_type ) . lower ( ) , map_type if map_type not in ( 'sampling' , 'interpolation' ) : raise ValueError ( '`map_type` {!r} not understood' '' . format ( map_type_in ) ) if not isinstance ( fspace , FunctionSpace ) : raise TypeError ( '`fspace` {!r} is not a `FunctionSpace` ' 'instance' . format ( fspace ) ) if not isinstance ( partition , RectPartition ) : raise TypeError ( '`partition` {!r} is not a `RectPartition` ' 'instance' . format ( partition ) ) if not isinstance ( tspace , TensorSpace ) : raise TypeError ( '`tspace` {!r} is not a `TensorSpace` instance' '' . format ( tspace ) ) if not fspace . domain . contains_set ( partition ) : raise ValueError ( '{} not contained in the domain {} ' 'of the function set {}' '' . format ( partition , fspace . domain , fspace ) ) if tspace . shape != partition . shape : raise ValueError ( '`tspace.shape` not equal to `partition.shape`: ' '{} != {}' '' . format ( tspace . shape , partition . shape ) ) domain = fspace if map_type == 'sampling' else tspace range = tspace if map_type == 'sampling' else fspace super ( FunctionSpaceMapping , self ) . __init__ ( domain , range , linear = linear ) self . __partition = partition if self . is_linear : if self . domain . field is None : raise TypeError ( '`fspace.field` cannot be `None` for ' '`linear=True`' ) if not is_numeric_dtype ( tspace . dtype ) : raise TypeError ( '`tspace.dtype` must be a numeric data type ' 'for `linear=True`, got {}' '' . format ( dtype_repr ( tspace ) ) ) if fspace . field != tspace . field : raise ValueError ( '`fspace.field` not equal to `tspace.field`: ' '{} != {}' '' . format ( fspace . field , tspace . field ) )
Initialize a new instance.

        Parameters
        ----------
        map_type : {'sampling', 'interpolation'}
            The type of operator
        fspace : `FunctionSpace`
            The non-discretized (abstract) set of functions to be
            discretized
        partition : `RectPartition`
            Partition of (a subset of) ``fspace.domain`` based on a
            `RectGrid`.
        tspace : `TensorSpace`
            Space providing containers for the values/coefficients of a
            discretized object. Its `TensorSpace.shape` must be equal
            to ``partition.shape``.
        linear : bool, optional
            Create a linear operator if ``True``, otherwise a non-linear
            operator.