Commit bf20b328 authored by Martin Reinecke's avatar Martin Reinecke

more work

parent 201a6a28
......@@ -101,12 +101,7 @@ class LMSpace(StructuredDomain):
# by Challinor et al.
# http://arxiv.org/abs/astro-ph/0008228
from ..sugar import exp
res = x+1.
res *= x
res *= -0.5*sigma*sigma
exp(res, out=res)
return res
return exp((x+1.) * x * (-0.5*sigma*sigma))
def get_fft_smoothing_kernel_function(self, sigma):
return lambda x: self._kernel(x, sigma)
......
......@@ -125,9 +125,10 @@ class DOFDistributor(LinearOperator):
else:
arr = x.local_data
arr = arr.reshape(self._hshape)
oarr = arr[(slice(None), self._dofdex, slice(None))]
return Field.from_local_data(self._target, oarr.reshape(self._target.local_shape))
oarr = res.local_data.reshape(self._pshape)
oarr = np.empty(self._pshape, dtype=x.dtype)
oarr[()] = arr[(slice(None), self._dofdex, slice(None))]
return Field.from_local_data(
self._target, oarr.reshape(self._target.local_shape))
def apply(self, x, mode):
self._check_input(x, mode)
......
......@@ -55,10 +55,8 @@ class QHTOperator(LinearOperator):
sl = (slice(None),)*i + (slice(1, None),)
if i == ax:
x = dobj.redistribute(x, nodist=(ax,))
curax = dobj.distaxis(x)
x = dobj.local_data(x)
x[sl] = hartley(x[sl], axes=(i,))
x = dobj.from_local_data(globshape, x, distaxis=curax)
tmp = dobj.local_data(x)
tmp[sl] = hartley(tmp[sl], axes=(i,))
if i == ax:
x = dobj.redistribute(x, dist=ax)
return Field(self._tgt(mode), val=x)
......
......@@ -16,6 +16,8 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from builtins import *
from ..utilities import my_sum
from .linear_operator import LinearOperator
import numpy as np
......@@ -187,7 +189,5 @@ class SumOperator(LinearOperator):
if from_inverse:
raise NotImplementedError(
"cannot draw from inverse of this operator")
res = self._ops[0].draw_sample(from_inverse, dtype)
for op in self._ops[1:]:
res += op.draw_sample(from_inverse, dtype)
return res
return my_sum(map(lambda op: op.draw_sample(from_inverse, dtype),
self._ops))
......@@ -22,10 +22,8 @@ class SymmetrizingOperator(EndomorphicOperator):
lead = (slice(None),)*i
if i == ax:
tmp = dobj.redistribute(tmp, nodist=(ax,))
curax = dobj.distaxis(tmp)
tmp = dobj.local_data(tmp)
tmp[lead + (slice(1, None),)] -= tmp[lead + (slice(None, 0, -1),)]
tmp = dobj.from_local_data(globshape, tmp, distaxis=curax)
tmp2 = dobj.local_data(tmp)
tmp2[lead+(slice(1, None),)] -= tmp2[lead+(slice(None, 0, -1),)]
if i == ax:
tmp = dobj.redistribute(tmp, dist=ax)
return Field(self.target, val=tmp)
......
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