Commit 4d24451e authored by Philipp Arras's avatar Philipp Arras

Cosmetics

parent 339a5bc6
......@@ -19,9 +19,9 @@
from __future__ import absolute_import, division, print_function
from ..compat import *
from .endomorphic_operator import EndomorphicOperator
from ..multi_domain import MultiDomain
from ..multi_field import MultiField
from .endomorphic_operator import EndomorphicOperator
class BlockDiagonalOperator(EndomorphicOperator):
......
......@@ -18,16 +18,16 @@
from __future__ import absolute_import, division, print_function
import numpy as np
import itertools
import numpy as np
from .. import dobj, utilities
from ..compat import *
from .. import utilities
from .linear_operator import LinearOperator
from ..domain_tuple import DomainTuple
from ..domains.rg_space import RGSpace
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
......@@ -95,7 +95,6 @@ class CentralZeroPadder(LinearOperator):
self._check_input(x, mode)
x = x.val
dax = dobj.distaxis(x)
shp_in = x.shape
shp_out = self._tgt(mode).shape
axes = self._target.axes[self._space]
if dax in axes:
......
......@@ -18,13 +18,11 @@
from __future__ import absolute_import, division, print_function
import numpy as np
from .. import utilities
from ..compat import *
from .diagonal_operator import DiagonalOperator
from .linear_operator import LinearOperator
from .. import utilities
from .scaling_operator import ScalingOperator
from .diagonal_operator import DiagonalOperator
from .simple_linear_operators import NullOperator
......@@ -44,8 +42,8 @@ class ChainOperator(LinearOperator):
@staticmethod
def simplify(ops):
# verify domains
for i in range(len(ops)-1):
if ops[i+1].target != ops[i].domain:
for i in range(len(ops) - 1):
if ops[i + 1].target != ops[i].domain:
raise ValueError("domain mismatch")
# unpack ChainOperators
opsnew = []
......@@ -78,9 +76,8 @@ class ChainOperator(LinearOperator):
# combine DiagonalOperators where possible
opsnew = []
for op in ops:
if (len(opsnew) > 0 and
isinstance(opsnew[-1], DiagonalOperator) and
isinstance(op, DiagonalOperator)):
if (len(opsnew) > 0 and isinstance(opsnew[-1], DiagonalOperator)
and isinstance(op, DiagonalOperator)):
opsnew[-1] = opsnew[-1]._combine_prod(op)
else:
opsnew.append(op)
......@@ -89,9 +86,9 @@ class ChainOperator(LinearOperator):
from .block_diagonal_operator import BlockDiagonalOperator
opsnew = []
for op in ops:
if (len(opsnew) > 0 and
isinstance(opsnew[-1], BlockDiagonalOperator) and
isinstance(op, BlockDiagonalOperator)):
if (len(opsnew) > 0
and isinstance(opsnew[-1], BlockDiagonalOperator)
and isinstance(op, BlockDiagonalOperator)):
opsnew[-1] = opsnew[-1]._combine_chain(op)
else:
opsnew.append(op)
......@@ -123,8 +120,8 @@ class ChainOperator(LinearOperator):
if trafo == 0:
return self
if trafo == ADJ or trafo == INV:
return self.make([op._flip_modes(trafo)
for op in reversed(self._ops)])
return self.make(
[op._flip_modes(trafo) for op in reversed(self._ops)])
if trafo == ADJ | INV:
return self.make([op._flip_modes(trafo) for op in self._ops])
raise ValueError("invalid operator transformation")
......@@ -136,6 +133,7 @@ class ChainOperator(LinearOperator):
x = op.apply(x, mode)
return x
# def draw_sample(self, from_inverse=False, dtype=np.float64):
# from ..sugar import from_random
# if len(self._ops) == 1:
......@@ -149,4 +147,4 @@ class ChainOperator(LinearOperator):
def __repr__(self):
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
import numpy as np
from .. import dobj
from .. import utilities
from ..compat import *
from ..domain_tuple import DomainTuple
from ..field import Field
from .linear_operator import LinearOperator
from .. import utilities
class DomainDistributor(LinearOperator):
......
......@@ -18,15 +18,15 @@
from __future__ import absolute_import, division, print_function
from .. import utilities
from ..compat import *
from ..domain_tuple import DomainTuple
from ..field import Field
from ..linearization import Linearization
from ..sugar import makeOp
from .operator import Operator
from .sandwich_operator import SandwichOperator
from .sampling_enabler import SamplingEnabler
from ..sugar import makeOp
from ..linearization import Linearization
from .. import utilities
from ..field import Field
from .sandwich_operator import SandwichOperator
from .simple_linear_operators import VdotOperator
......
......@@ -26,8 +26,8 @@ from ..domain_tuple import DomainTuple
from ..domains.power_space import PowerSpace
from ..domains.rg_space import RGSpace
from ..field import Field
from .linear_operator import LinearOperator
from ..utilities import infer_space, special_add_at
from .linear_operator import LinearOperator
class ExpTransform(LinearOperator):
......
......@@ -2,13 +2,12 @@ from __future__ import absolute_import, division, print_function
import numpy as np
from .. import dobj
from .. import dobj, utilities
from ..compat import *
from ..domain_tuple import DomainTuple
from ..domains.rg_space import RGSpace
from ..field import Field
from .linear_operator import LinearOperator
from .. import utilities
class FieldZeroPadder(LinearOperator):
......
......@@ -23,12 +23,12 @@ import numpy as np
from .. import dobj, utilities
from ..compat import *
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.lm_space import LMSpace
from ..domains.rg_space import RGSpace
from ..field import Field
from .linear_operator import LinearOperator
from .diagonal_operator import DiagonalOperator
from .linear_operator import LinearOperator
from .scaling_operator import ScalingOperator
......
......@@ -18,8 +18,6 @@
from __future__ import absolute_import, division, print_function
import numpy as np
from ..compat import *
from .operator import Operator
......
from __future__ import absolute_import, division, print_function
from ..compat import *
from ..utilities import NiftyMetaBase, my_product
from ..domain_tuple import DomainTuple
from ..utilities import NiftyMetaBase
class Operator(NiftyMetaBase()):
......
......@@ -21,10 +21,8 @@ from __future__ import absolute_import, division, print_function
import numpy as np
from ..compat import *
from ..domain_tuple import DomainTuple
from ..sugar import full
from .endomorphic_operator import EndomorphicOperator
from .. import utilities
class ScalingOperator(EndomorphicOperator):
......
......@@ -18,17 +18,15 @@
from __future__ import absolute_import, division, print_function
import numpy as np
from ..compat import *
from ..domain_tuple import DomainTuple
from ..multi_domain import MultiDomain
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 ..multi_domain import MultiDomain
from ..multi_field import MultiField
from ..sugar import full
from .endomorphic_operator import EndomorphicOperator
from .linear_operator import LinearOperator
class VdotOperator(LinearOperator):
......
......@@ -18,16 +18,15 @@
from __future__ import absolute_import, division, print_function
from collections import defaultdict
import numpy as np
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 ..utilities import indent
from .block_diagonal_operator import BlockDiagonalOperator
from .linear_operator import LinearOperator
class SumOperator(LinearOperator):
......
......@@ -18,13 +18,12 @@
from __future__ import absolute_import, division, print_function
from .. import dobj
from .. import dobj, utilities
from ..compat import *
from ..domain_tuple import DomainTuple
from ..domains.log_rg_space import LogRGSpace
from ..field import Field
from .endomorphic_operator import EndomorphicOperator
from .. import utilities
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!
Please register or to comment