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
70bb83ae
Commit
70bb83ae
authored
May 21, 2020
by
Philipp Arras
Browse files
Add type checks
parent
06333722
Pipeline
#75406
passed with stages
in 9 minutes and 10 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
nifty6/operators/simple_linear_operators.py
View file @
70bb83ae
...
...
@@ -11,19 +11,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-20
19
Max-Planck-Society
# Copyright(C) 2013-20
20
Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
from
..domain_tuple
import
DomainTuple
from
..multi_domain
import
MultiDomain
from
..domains.unstructured_domain
import
UnstructuredDomain
from
..field
import
Field
from
..multi_domain
import
MultiDomain
from
..multi_field
import
MultiField
from
.linear_operator
import
LinearOperator
from
.endomorphic_operator
import
EndomorphicOperator
from
..
import
utilities
import
numpy
as
np
from
.linear_operator
import
LinearOperator
class
VdotOperator
(
LinearOperator
):
...
...
@@ -128,7 +128,11 @@ class Imaginizer(EndomorphicOperator):
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
if
mode
==
self
.
TIMES
:
if
not
np
.
issubdtype
(
x
.
dtype
,
np
.
complexfloating
):
raise
ValueError
return
x
.
imag
if
x
.
dtype
not
in
(
np
.
float64
,
np
.
float32
):
raise
ValueError
return
1j
*
x
...
...
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