Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
13
Merge Requests
13
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
46f15758
Commit
46f15758
authored
Mar 27, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
Showing
1 changed file
with
8 additions
and
13 deletions
+8
-13
nifty4/operators/scaling_operator.py
nifty4/operators/scaling_operator.py
+8
-13
No files found.
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
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