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
4979c086
Commit
4979c086
authored
May 14, 2017
by
Pumpe, Daniel (dpumpe)
Browse files
tests for ComposedOperator
parent
abb04e8f
Pipeline
#12414
passed with stage
in 4 minutes and 55 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_operators/test_composed_operator.py
View file @
4979c086
...
...
@@ -16,19 +16,19 @@ from test.common import expand
class
ComposedOperator_Tests
(
unittest
.
TestCase
):
spaces
=
generate_spaces
()
@
expand
(
product
(
[
spaces
]
,
[
spaces
]
))
@
expand
(
product
(
spaces
,
spaces
))
def
test_property
(
self
,
space1
,
space2
):
rand1
=
Field
.
from_random
(
'normal'
,
domain
=
space1
)
rand2
=
Field
.
from_random
(
'normal'
,
domain
=
space2
)
op1
=
DiagonalOperator
(
space1
,
diagonal
=
rand1
)
op2
=
DiagonalOperator
(
space2
,
diagonal
=
rand2
)
op
=
ComposedOperator
((
op1
,
op2
))
if
op
.
domain
!=
(
op1
.
domain
,
op2
.
domain
):
if
op
.
domain
!=
(
op1
.
domain
[
0
]
,
op2
.
domain
[
0
]
):
raise
TypeError
if
op
.
unitary
!=
False
:
raise
ValueError
@
expand
(
product
(
[
spaces
],[
spaces
]
))
@
expand
(
product
(
spaces
,
spaces
))
def
test_times_adjoint_times
(
self
,
space1
,
space2
):
diag1
=
Field
.
from_random
(
'normal'
,
domain
=
space1
)
diag2
=
Field
.
from_random
(
'normal'
,
domain
=
space2
)
...
...
@@ -44,7 +44,7 @@ class ComposedOperator_Tests(unittest.TestCase):
tt2
=
rand1
.
dot
(
op
.
adjoint_times
(
rand2
))
assert_approx_equal
(
tt1
,
tt2
)
@
expand
(
product
(
[
spaces
]
,
[
spaces
]
))
@
expand
(
product
(
spaces
,
spaces
))
def
test_times_inverse_times
(
self
,
space1
,
space2
):
diag1
=
Field
.
from_random
(
'normal'
,
domain
=
space1
)
diag2
=
Field
.
from_random
(
'normal'
,
domain
=
space2
)
...
...
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