Commit 4d24451e by Philipp Arras

Cosmetics

parent 339a5bc6
 ... @@ -19,9 +19,9 @@ ... @@ -19,9 +19,9 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function from ..compat import * from ..compat import * from .endomorphic_operator import EndomorphicOperator from ..multi_domain import MultiDomain from ..multi_domain import MultiDomain from ..multi_field import MultiField from ..multi_field import MultiField from .endomorphic_operator import EndomorphicOperator class BlockDiagonalOperator(EndomorphicOperator): class BlockDiagonalOperator(EndomorphicOperator): ... ...
 ... @@ -18,16 +18,16 @@ ... @@ -18,16 +18,16 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function import numpy as np import itertools import itertools import numpy as np from .. import dobj, utilities from ..compat import * from ..compat import * from .. import utilities from .linear_operator import LinearOperator from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..domains.rg_space import RGSpace from ..domains.rg_space import RGSpace from ..field import Field from ..field import Field from .. import dobj from .linear_operator import LinearOperator # MR FIXME: for even axis lengths, we probably should split the value at the # MR FIXME: for even axis lengths, we probably should split the value at the ... @@ -95,7 +95,6 @@ class CentralZeroPadder(LinearOperator): ... @@ -95,7 +95,6 @@ class CentralZeroPadder(LinearOperator): self._check_input(x, mode) self._check_input(x, mode) x = x.val x = x.val dax = dobj.distaxis(x) dax = dobj.distaxis(x) shp_in = x.shape shp_out = self._tgt(mode).shape shp_out = self._tgt(mode).shape axes = self._target.axes[self._space] axes = self._target.axes[self._space] if dax in axes: if dax in axes: ... ...
 ... @@ -18,13 +18,11 @@ ... @@ -18,13 +18,11 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function import numpy as np from .. import utilities from ..compat import * from ..compat import * from .diagonal_operator import DiagonalOperator from .linear_operator import LinearOperator from .linear_operator import LinearOperator from .. import utilities from .scaling_operator import ScalingOperator from .scaling_operator import ScalingOperator from .diagonal_operator import DiagonalOperator from .simple_linear_operators import NullOperator from .simple_linear_operators import NullOperator ... @@ -44,8 +42,8 @@ class ChainOperator(LinearOperator): ... @@ -44,8 +42,8 @@ class ChainOperator(LinearOperator): @staticmethod @staticmethod def simplify(ops): def simplify(ops): # verify domains # verify domains for i in range(len(ops)-1): for i in range(len(ops) - 1): if ops[i+1].target != ops[i].domain: if ops[i + 1].target != ops[i].domain: raise ValueError("domain mismatch") raise ValueError("domain mismatch") # unpack ChainOperators # unpack ChainOperators opsnew = [] opsnew = [] ... @@ -78,9 +76,8 @@ class ChainOperator(LinearOperator): ... @@ -78,9 +76,8 @@ class ChainOperator(LinearOperator): # combine DiagonalOperators where possible # combine DiagonalOperators where possible opsnew = [] opsnew = [] for op in ops: for op in ops: if (len(opsnew) > 0 and if (len(opsnew) > 0 and isinstance(opsnew[-1], DiagonalOperator) isinstance(opsnew[-1], DiagonalOperator) and and isinstance(op, DiagonalOperator)): isinstance(op, DiagonalOperator)): opsnew[-1] = opsnew[-1]._combine_prod(op) opsnew[-1] = opsnew[-1]._combine_prod(op) else: else: opsnew.append(op) opsnew.append(op) ... @@ -89,9 +86,9 @@ class ChainOperator(LinearOperator): ... @@ -89,9 +86,9 @@ class ChainOperator(LinearOperator): from .block_diagonal_operator import BlockDiagonalOperator from .block_diagonal_operator import BlockDiagonalOperator opsnew = [] opsnew = [] for op in ops: for op in ops: if (len(opsnew) > 0 and if (len(opsnew) > 0 isinstance(opsnew[-1], BlockDiagonalOperator) and and isinstance(opsnew[-1], BlockDiagonalOperator) isinstance(op, BlockDiagonalOperator)): and isinstance(op, BlockDiagonalOperator)): opsnew[-1] = opsnew[-1]._combine_chain(op) opsnew[-1] = opsnew[-1]._combine_chain(op) else: else: opsnew.append(op) opsnew.append(op) ... @@ -123,8 +120,8 @@ class ChainOperator(LinearOperator): ... @@ -123,8 +120,8 @@ class ChainOperator(LinearOperator): if trafo == 0: if trafo == 0: return self return self if trafo == ADJ or trafo == INV: if trafo == ADJ or trafo == INV: return self.make([op._flip_modes(trafo) return self.make( for op in reversed(self._ops)]) [op._flip_modes(trafo) for op in reversed(self._ops)]) if trafo == ADJ | INV: if trafo == ADJ | INV: return self.make([op._flip_modes(trafo) for op in self._ops]) return self.make([op._flip_modes(trafo) for op in self._ops]) raise ValueError("invalid operator transformation") raise ValueError("invalid operator transformation") ... @@ -136,6 +133,7 @@ class ChainOperator(LinearOperator): ... @@ -136,6 +133,7 @@ class ChainOperator(LinearOperator): x = op.apply(x, mode) x = op.apply(x, mode) return x return x # def draw_sample(self, from_inverse=False, dtype=np.float64): # def draw_sample(self, from_inverse=False, dtype=np.float64): # from ..sugar import from_random # from ..sugar import from_random # if len(self._ops) == 1: # if len(self._ops) == 1: ... @@ -149,4 +147,4 @@ class ChainOperator(LinearOperator): ... @@ -149,4 +147,4 @@ class ChainOperator(LinearOperator): def __repr__(self): def __repr__(self): subs = "\n".join(sub.__repr__() for sub in self._ops) subs = "\n".join(sub.__repr__() for sub in self._ops) return "ChainOperator:\n"+utilities.indent(subs) return "ChainOperator:\n" + utilities.indent(subs)
 ... @@ -20,12 +20,11 @@ from __future__ import absolute_import, division, print_function ... @@ -20,12 +20,11 @@ from __future__ import absolute_import, division, print_function import numpy as np import numpy as np from .. import dobj from .. import utilities from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..field import Field from ..field import Field from .linear_operator import LinearOperator from .linear_operator import LinearOperator from .. import utilities class DomainDistributor(LinearOperator): class DomainDistributor(LinearOperator): ... ...
 ... @@ -18,15 +18,15 @@ ... @@ -18,15 +18,15 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function from .. import utilities from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..field import Field from ..linearization import Linearization from ..sugar import makeOp from .operator import Operator from .operator import Operator from .sandwich_operator import SandwichOperator from .sampling_enabler import SamplingEnabler from .sampling_enabler import SamplingEnabler from ..sugar import makeOp from .sandwich_operator import SandwichOperator from ..linearization import Linearization from .. import utilities from ..field import Field from .simple_linear_operators import VdotOperator from .simple_linear_operators import VdotOperator ... ...
 ... @@ -26,8 +26,8 @@ from ..domain_tuple import DomainTuple ... @@ -26,8 +26,8 @@ from ..domain_tuple import DomainTuple from ..domains.power_space import PowerSpace from ..domains.power_space import PowerSpace from ..domains.rg_space import RGSpace from ..domains.rg_space import RGSpace from ..field import Field from ..field import Field from .linear_operator import LinearOperator from ..utilities import infer_space, special_add_at from ..utilities import infer_space, special_add_at from .linear_operator import LinearOperator class ExpTransform(LinearOperator): class ExpTransform(LinearOperator): ... ...
 ... @@ -2,13 +2,12 @@ from __future__ import absolute_import, division, print_function ... @@ -2,13 +2,12 @@ from __future__ import absolute_import, division, print_function import numpy as np import numpy as np from .. import dobj from .. import dobj, utilities from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..domains.rg_space import RGSpace from ..domains.rg_space import RGSpace from ..field import Field from ..field import Field from .linear_operator import LinearOperator from .linear_operator import LinearOperator from .. import utilities class FieldZeroPadder(LinearOperator): class FieldZeroPadder(LinearOperator): ... ...
 ... @@ -23,12 +23,12 @@ import numpy as np ... @@ -23,12 +23,12 @@ import numpy as np from .. import dobj, utilities from .. import dobj, utilities from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..domains.rg_space import RGSpace from ..domains.lm_space import LMSpace from ..domains.gl_space import GLSpace from ..domains.gl_space import GLSpace from ..domains.lm_space import LMSpace from ..domains.rg_space import RGSpace from ..field import Field from ..field import Field from .linear_operator import LinearOperator from .diagonal_operator import DiagonalOperator from .diagonal_operator import DiagonalOperator from .linear_operator import LinearOperator from .scaling_operator import ScalingOperator from .scaling_operator import ScalingOperator ... ...
 ... @@ -18,8 +18,6 @@ ... @@ -18,8 +18,6 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function import numpy as np from ..compat import * from ..compat import * from .operator import Operator from .operator import Operator ... ...
 from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function from ..compat import * from ..compat import * from ..utilities import NiftyMetaBase, my_product from ..utilities import NiftyMetaBase from ..domain_tuple import DomainTuple class Operator(NiftyMetaBase()): class Operator(NiftyMetaBase()): ... ...
 ... @@ -21,10 +21,8 @@ from __future__ import absolute_import, division, print_function ... @@ -21,10 +21,8 @@ from __future__ import absolute_import, division, print_function import numpy as np import numpy as np from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..sugar import full from ..sugar import full from .endomorphic_operator import EndomorphicOperator from .endomorphic_operator import EndomorphicOperator from .. import utilities class ScalingOperator(EndomorphicOperator): class ScalingOperator(EndomorphicOperator): ... ...
 ... @@ -18,17 +18,15 @@ ... @@ -18,17 +18,15 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function import numpy as np from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..multi_domain import MultiDomain from ..domains.unstructured_domain import UnstructuredDomain from ..domains.unstructured_domain import UnstructuredDomain from .linear_operator import LinearOperator from .endomorphic_operator import EndomorphicOperator from ..sugar import full from ..field import Field from ..field import Field from ..multi_domain import MultiDomain from ..multi_field import MultiField from ..multi_field import MultiField from ..sugar import full from .endomorphic_operator import EndomorphicOperator from .linear_operator import LinearOperator class VdotOperator(LinearOperator): class VdotOperator(LinearOperator): ... ...
 ... @@ -18,16 +18,15 @@ ... @@ -18,16 +18,15 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function from collections import defaultdict import numpy as np import numpy as np from ..compat import * from ..compat import * from ..utilities import my_sum, indent from .linear_operator import LinearOperator from .scaling_operator import ScalingOperator from .diagonal_operator import DiagonalOperator from .block_diagonal_operator import BlockDiagonalOperator from collections import defaultdict from ..sugar import domain_union from ..sugar import domain_union from ..utilities import indent from .block_diagonal_operator import BlockDiagonalOperator from .linear_operator import LinearOperator class SumOperator(LinearOperator): class SumOperator(LinearOperator): ... ...
 ... @@ -18,13 +18,12 @@ ... @@ -18,13 +18,12 @@ from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function from .. import dobj from .. import dobj, utilities from ..compat import * from ..compat import * from ..domain_tuple import DomainTuple from ..domain_tuple import DomainTuple from ..domains.log_rg_space import LogRGSpace from ..domains.log_rg_space import LogRGSpace from ..field import Field from ..field import Field from .endomorphic_operator import EndomorphicOperator from .endomorphic_operator import EndomorphicOperator from .. import utilities class SymmetrizingOperator(EndomorphicOperator): class SymmetrizingOperator(EndomorphicOperator): ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!