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
46f15758
Commit
46f15758
authored
Mar 27, 2018
by
Martin Reinecke
Browse files
compactify
parent
bfeb39ae
Pipeline
#26499
passed with stage
in 5 minutes and 35 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty4/operators/scaling_operator.py
View file @
46f15758
...
...
@@ -98,19 +98,14 @@ class ScalingOperator(EndomorphicOperator):
raise
ValueError
(
"Operator not positive definite"
)
return
sample
*
np
.
sqrt
(
self
.
_factor
)
def
draw
_sample
(
self
,
dtype
=
np
.
float64
):
if
self
.
_factor
.
imag
!=
0.
or
self
.
_factor
.
real
<=
0.
:
def
_sample
_helper
(
self
,
fct
,
dtype
):
if
fct
.
imag
!=
0.
or
fct
.
real
<=
0.
:
raise
ValueError
(
"operator not positive definite"
)
return
Field
.
from_random
(
random_type
=
"normal"
,
domain
=
self
.
_domain
,
std
=
np
.
sqrt
(
self
.
_factor
),
dtype
=
dtype
)
return
Field
.
from_random
(
random_type
=
"normal"
,
domain
=
self
.
_domain
,
std
=
fct
,
dtype
=
dtype
)
def
inverse_draw_sample
(
self
,
dtype
=
np
.
float64
):
if
self
.
_factor
.
imag
!=
0.
or
self
.
_factor
.
real
<=
0.
:
raise
ValueError
(
"operator not positive definite"
)
def
draw_sample
(
self
,
dtype
=
np
.
float64
):
return
self
.
_sample_helper
(
np
.
sqrt
(
self
.
_factor
),
dtype
)
return
Field
.
from_random
(
random_type
=
"normal"
,
domain
=
self
.
_domain
,
std
=
1.
/
np
.
sqrt
(
self
.
_factor
),
dtype
=
dtype
)
def
inverse_draw_sample
(
self
,
dtype
=
np
.
float64
):
return
self
.
_sample_helper
(
1.
/
np
.
sqrt
(
self
.
_factor
),
dtype
)
Write
Preview
Supports
Markdown
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