Skip to content
GitLab
Menu
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
5440d759
Commit
5440d759
authored
Apr 30, 2018
by
Reimar H Leike
Browse files
fixed a bug in the scaling operator that prhibited sampling from an operator with 0s
parent
ffd03728
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty4/operators/scaling_operator.py
View file @
5440d759
...
...
@@ -98,7 +98,9 @@ class ScalingOperator(EndomorphicOperator):
def
draw_sample
(
self
,
from_inverse
=
False
,
dtype
=
np
.
float64
):
fct
=
self
.
_factor
if
fct
.
imag
!=
0.
or
fct
.
real
<=
0.
:
if
fct
.
imag
!=
0.
or
fct
.
real
<
0.
:
raise
ValueError
(
"operator not positive definite"
)
if
fct
.
real
==
0
and
from_inverse
:
raise
ValueError
(
"operator not positive definite"
)
fct
=
1.
/
np
.
sqrt
(
fct
)
if
from_inverse
else
np
.
sqrt
(
fct
)
return
Field
.
from_random
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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