Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
0ad1f1db
Commit
0ad1f1db
authored
May 29, 2017
by
Martin Reinecke
Browse files
work around floating point errors
parent
82a92a51
Pipeline
#13065
passed with stage
in 5 minutes and 21 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/operators/smoothing_operator/direct_smoothing_operator.py
View file @
0ad1f1db
...
...
@@ -53,10 +53,13 @@ class DirectSmoothingOperator(SmoothingOperator):
wgt
=
[]
expfac
=
1.
/
(
2.
*
sigma
*
sigma
)
for
i
in
range
(
x
.
size
):
t
=
x
[
ibegin
[
i
]:
ibegin
[
i
]
+
nval
[
i
]]
-
x
[
i
]
t
=
np
.
exp
(
-
t
*
t
*
expfac
)
t
*=
1.
/
np
.
sum
(
t
)
wgt
.
append
(
t
)
if
nval
[
i
]
>
0
:
t
=
x
[
ibegin
[
i
]:
ibegin
[
i
]
+
nval
[
i
]]
-
x
[
i
]
t
=
np
.
exp
(
-
t
*
t
*
expfac
)
t
*=
1.
/
np
.
sum
(
t
)
wgt
.
append
(
t
)
else
:
wgt
.
append
(
np
.
array
([]))
return
ibegin
,
nval
,
wgt
...
...
@@ -146,7 +149,7 @@ class DirectSmoothingOperator(SmoothingOperator):
#MR FIXME: this causes calls of log(0.) which should probably be avoided
if
self
.
log_distances
:
np
.
log
(
distance_array
,
out
=
distance_array
)
np
.
log
(
np
.
maximum
(
distance_array
,
1e-15
),
out
=
distance_array
)
# collect the local data + ghost cells
local_data_Q
=
False
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment