Commit 1533d285 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

tweaks

parent c8018d8e
Pipeline #28422 passed with stages
in 2 minutes and 53 seconds
......@@ -28,6 +28,10 @@ class MultiField(object):
def domain(self):
return MultiDomain({key: val.domain for key, val in self._val.items()})
@property
def dtype(self):
return {key: val.dtype for key, val in self._val.items()}
def _check_domain(self, other):
if other.domain != self.domain:
raise ValueError("domains are incompatible.")
......@@ -57,19 +61,19 @@ class MultiField(object):
@staticmethod
def zeros(domain, dtype=None):
dtype = self.build_dtype(dtype, domain)
dtype = MultiField.build_dtype(dtype, domain)
return MultiField({key: Field.zeros(dom, dtype=dtype[key])
for key, dom in domain.items()})
@staticmethod
def ones(domain, dtype=None):
dtype = self.build_dtype(dtype, domain)
dtype = MultiField.build_dtype(dtype, domain)
return MultiField({key: Field.ones(dom, dtype=dtype[key])
for key, dom in domain.items()})
@staticmethod
def empty(domain, dtype=None):
dtype = self.build_dtype(dtype, domain)
dtype = MultiField.build_dtype(dtype, domain)
return MultiField({key: Field.empty(dom, dtype=dtype[key])
for key, dom in domain.items()})
......
......@@ -18,7 +18,6 @@
from ..minimization.quadratic_energy import QuadraticEnergy
from ..minimization.iteration_controller import IterationController
from ..field import Field
from ..logger import logger
from .endomorphic_operator import EndomorphicOperator
import numpy as np
......@@ -68,7 +67,7 @@ class InversionEnabler(EndomorphicOperator):
if self._op.capability & mode:
return self._op.apply(x, mode)
x0 = Field.zeros(self._tgt(mode), dtype=x.dtype)
x0 = x.zeros(self._tgt(mode), dtype=x.dtype)
invmode = self._modeTable[self.INVERSE_BIT][self._ilog[mode]]
invop = self._op._flip_modes(self._ilog[invmode])
prec = self._approximation
......
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