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
9b06ed3a
Commit
9b06ed3a
authored
Aug 08, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup
parent
816d3fab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
26 deletions
+14
-26
nifty5/operators/scaling_operator.py
nifty5/operators/scaling_operator.py
+14
-26
No files found.
nifty5/operators/scaling_operator.py
View file @
9b06ed3a
...
...
@@ -63,36 +63,24 @@ class ScalingOperator(EndomorphicOperator):
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
if
self
.
_factor
==
1.
:
fct
=
self
.
_factor
if
fct
==
1.
:
return
x
if
self
.
_factor
==
0.
:
if
fct
==
0.
:
return
full
(
self
.
domain
,
0.
)
if
mode
==
self
.
TIMES
:
return
x
*
self
.
_factor
elif
mode
==
self
.
ADJOINT_TIMES
:
return
x
*
np
.
conj
(
self
.
_factor
)
elif
mode
==
self
.
INVERSE_TIMES
:
return
x
*
(
1.
/
self
.
_factor
)
else
:
return
x
*
(
1.
/
np
.
conj
(
self
.
_factor
))
if
(
mode
&
10
)
!=
0
:
fct
=
np
.
conj
(
fct
)
if
(
mode
&
12
)
!=
0
:
fct
=
1.
/
fct
return
x
*
fct
def
_flip_modes
(
self
,
trafo
):
ADJ
=
self
.
ADJOINT_BIT
INV
=
self
.
INVERSE_BIT
if
trafo
==
0
:
return
self
if
trafo
==
ADJ
and
not
np
.
iscomplex
(
self
.
_factor
):
return
self
if
trafo
==
ADJ
:
return
ScalingOperator
(
np
.
conj
(
self
.
_factor
),
self
.
_domain
)
elif
trafo
==
INV
:
return
ScalingOperator
(
1.
/
self
.
_factor
,
self
.
_domain
)
elif
trafo
==
ADJ
|
INV
:
return
ScalingOperator
(
1.
/
np
.
conj
(
self
.
_factor
),
self
.
_domain
)
raise
ValueError
(
"invalid operator transformation"
)
fct
=
self
.
_factor
if
trafo
&
self
.
ADJOINT_BIT
:
fct
=
np
.
conj
(
fct
)
if
trafo
&
self
.
INVERSE_BIT
:
fct
=
1.
/
fct
return
ScalingOperator
(
fct
,
self
.
_domain
)
@
property
def
domain
(
self
):
...
...
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