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
34b9495c
Commit
34b9495c
authored
Jul 12, 2018
by
Philipp Arras
Browse files
Add type checking to PowerDistributor
parent
28debe14
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/power_distributor.py
View file @
34b9495c
...
@@ -18,6 +18,8 @@
...
@@ -18,6 +18,8 @@
from
__future__
import
absolute_import
,
division
,
print_function
from
__future__
import
absolute_import
,
division
,
print_function
import
numpy
as
np
from
..compat
import
*
from
..compat
import
*
from
..domain_tuple
import
DomainTuple
from
..domain_tuple
import
DomainTuple
from
..domains.power_space
import
PowerSpace
from
..domains.power_space
import
PowerSpace
...
@@ -57,3 +59,12 @@ class PowerDistributor(DOFDistributor):
...
@@ -57,3 +59,12 @@ class PowerDistributor(DOFDistributor):
raise
ValueError
(
"power_space does not match its partner"
)
raise
ValueError
(
"power_space does not match its partner"
)
self
.
_init2
(
power_space
.
pindex
,
self
.
_space
,
power_space
)
self
.
_init2
(
power_space
.
pindex
,
self
.
_space
,
power_space
)
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
if
x
.
dtype
==
np
.
complex
:
if
x
.
imag
.
sum
()
==
0
:
x
=
x
.
real
else
:
raise
TypeError
return
DOFDistributor
.
apply
(
self
,
x
,
mode
)
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