Commit 80d3ebe0 by Martin Reinecke

### move more operators

parent 1533d285
Pipeline #28432 passed with stages
in 2 minutes and 37 seconds
 from .multi_domain import MultiDomain from .multi_field import MultiField from .multi_linear_operator import MultiLinearOperator from .multi_endomorphic_operator import MultiEndomorphicOperator from .multi_chain_operator import MultiChainOperator from .multi_sum_operator import MultiSumOperator from .multi_scaling_operator import MultiScalingOperator __all__ = ["MultiDomain", "MultiField", "MultiLinearOperator", "MultiChainOperator", "MultiSumOperator"] "MultiEndomorphicOperator", "MultiChainOperator", "MultiSumOperator", "MultiScalingOperator"]
 ... ... @@ -64,7 +64,7 @@ class MultiChainOperator(MultiLinearOperator): return self._capability def apply(self, x, mode): self._check_mode(mode) self._check_input(x, mode) t_ops = self._ops if mode & self._backwards else reversed(self._ops) for op in t_ops: x = op.apply(x, mode) ... ...
 import numpy as np from .multi_linear_operator import MultiLinearOperator class MultiEndomorphicOperator(MultiLinearOperator): """ Class for multi endomorphic operators. By definition, domain and target are the same in EndomorphicOperator. """ @property def target(self): """ MultiDomain : returns :attr:`domain` Returns `self.domain`, because this is also the target domain for endomorphic operators. """ return self.domain def draw_sample(self, from_inverse=False, dtype=np.float64): """Generate a zero-mean sample Generates a sample from a Gaussian distribution with zero mean and covariance given by the operator. If from_inverse is True, the sample is drawn from the inverse of the operator. Returns ------- MultiField A sample from the Gaussian of given covariance. """ raise NotImplementedError
 from ..operators.linear_operator import LinearOperator from .multi_field import MultiField class MultiLinearOperator(LinearOperator): ... ... @@ -38,3 +39,11 @@ class MultiLinearOperator(LinearOperator): from .multi_sum_operator import MultiSumOperator other = self._toOperator(other, self.domain) return MultiSumOperator.make([other, self], [False, True]) def _check_input(self, x, mode): if not isinstance(x, MultiField): raise ValueError("supplied object is not a `MultiField`.") self._check_mode(mode) if x.domain != self._dom(mode): raise ValueError("The operator's and field's domains don't match.")