Commit 95248edc authored by Martin Reinecke's avatar Martin Reinecke

add a few FIXMEs

parent cd0fda66
Pipeline #12736 passed with stage
in 4 minutes and 37 seconds
...@@ -144,6 +144,7 @@ class DirectSmoothingOperator(SmoothingOperator): ...@@ -144,6 +144,7 @@ class DirectSmoothingOperator(SmoothingOperator):
distribution_strategy='not') distribution_strategy='not')
distance_array = distance_array.get_local_data(copy=False) distance_array = distance_array.get_local_data(copy=False)
#MR FIXME: this causes calls of log(0.) which should probably be avoided
if self.log_distances: if self.log_distances:
np.log(distance_array, out=distance_array) np.log(distance_array, out=distance_array)
......
...@@ -24,6 +24,7 @@ class FFTSmoothingOperator(SmoothingOperator): ...@@ -24,6 +24,7 @@ class FFTSmoothingOperator(SmoothingOperator):
kernel = codomain.get_distance_array( kernel = codomain.get_distance_array(
distribution_strategy=axes_local_distribution_strategy) distribution_strategy=axes_local_distribution_strategy)
#MR FIXME: this causes calls of log(0.) which should probably be avoided
if self.log_distances: if self.log_distances:
kernel.apply_scalar_function(np.log, inplace=True) kernel.apply_scalar_function(np.log, inplace=True)
...@@ -43,6 +44,7 @@ class FFTSmoothingOperator(SmoothingOperator): ...@@ -43,6 +44,7 @@ class FFTSmoothingOperator(SmoothingOperator):
# apply the kernel # apply the kernel
if inverse: if inverse:
#MR FIXME: danger of having division by zero or overflows
local_transformed_x /= local_kernel local_transformed_x /= local_kernel
else: else:
local_transformed_x *= local_kernel local_transformed_x *= local_kernel
......
...@@ -106,6 +106,7 @@ class DiagonalOperator_Tests(unittest.TestCase): ...@@ -106,6 +106,7 @@ class DiagonalOperator_Tests(unittest.TestCase):
assert_allclose(trace_op, np.sum(1./diag.val.get_full_data())) assert_allclose(trace_op, np.sum(1./diag.val.get_full_data()))
@expand(product(spaces, [True, False])) @expand(product(spaces, [True, False]))
#MR FIXME: what if any diagonal element <=0?
def test_trace_log(self, space, copy): def test_trace_log(self, space, copy):
diag = Field.from_random('normal', domain=space) diag = Field.from_random('normal', domain=space)
D = DiagonalOperator(space, diagonal=diag, copy=copy) D = DiagonalOperator(space, diagonal=diag, copy=copy)
...@@ -127,8 +128,9 @@ class DiagonalOperator_Tests(unittest.TestCase): ...@@ -127,8 +128,9 @@ class DiagonalOperator_Tests(unittest.TestCase):
assert_allclose(inv_det, 1./D.determinant()) assert_allclose(inv_det, 1./D.determinant())
@expand(product(spaces, [True, False], [True, False])) @expand(product(spaces, [True, False], [True, False]))
#MR FIXME: what if determinant <=0?
def test_log_determinant(self, space, bare, copy): def test_log_determinant(self, space, bare, copy):
diag = Field.from_random('normal', domain=space) diag = Field.from_random('normal', domain=space)
D = DiagonalOperator(space, diagonal=diag, bare=bare, copy=copy) D = DiagonalOperator(space, diagonal=diag, bare=bare, copy=copy)
log_det = D.log_determinant() log_det = D.log_determinant()
assert_allclose(log_det, np.log(D.determinant())) assert_allclose(log_det, np.log(D.determinant()))
\ No newline at end of file
...@@ -36,9 +36,6 @@ def _get_rtol(tp): ...@@ -36,9 +36,6 @@ def _get_rtol(tp):
else: else:
return 1e-5 return 1e-5
from itertools import product
from test.common import expand
class SmoothingOperator_Tests(unittest.TestCase): class SmoothingOperator_Tests(unittest.TestCase):
spaces = [RGSpace(100)] spaces = [RGSpace(100)]
......
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