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
8777dedc
Commit
8777dedc
authored
Jul 19, 2018
by
Reimar H Leike
Browse files
added tests for operator combinations. Now all operators are tested for consistency
parent
b4d6eceb
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/test_operators/test_adjoint.py
View file @
8777dedc
...
...
@@ -35,6 +35,20 @@ _pow_spaces = [ift.PowerSpace(ift.RGSpace((17, 38), harmonic=True))]
class
Consistency_Tests
(
unittest
.
TestCase
):
@
expand
(
product
(
_h_spaces
+
_p_spaces
+
_pow_spaces
,
[
np
.
float64
,
np
.
complex128
]))
def
testOperatorCombinations
(
self
,
sp
,
dtype
):
a
=
ift
.
DiagonalOperator
(
ift
.
Field
.
from_random
(
"normal"
,
sp
,
dtype
=
dtype
))
b
=
ift
.
DiagonalOperator
(
ift
.
Field
.
from_random
(
"normal"
,
sp
,
dtype
=
dtype
))
op
=
ift
.
SandwichOperator
.
make
(
a
,
b
)
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
op
=
a
*
b
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
op
=
a
+
b
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
@
expand
(
product
([(
ift
.
RGSpace
(
10
,
harmonic
=
True
),
4
,
0
),
(
ift
.
RGSpace
((
24
,
31
),
distances
=
(
0.4
,
2.34
),
harmonic
=
True
),
3
,
0
),
...
...
@@ -56,16 +70,6 @@ class Consistency_Tests(unittest.TestCase):
op
=
ift
.
SelectionOperator
(
mdom
,
'a'
)
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
@
expand
(
product
(
_h_spaces
+
_p_spaces
+
_pow_spaces
,
[
np
.
float64
,
np
.
complex128
]))
def
testSandwichOperator
(
self
,
sp
,
dtype
):
bun
=
ift
.
DiagonalOperator
(
ift
.
Field
.
from_random
(
"normal"
,
sp
,
dtype
=
dtype
))
cheese
=
ift
.
DiagonalOperator
(
ift
.
Field
.
from_random
(
"normal"
,
sp
,
dtype
=
dtype
))
op
=
ift
.
SandwichOperator
.
make
(
bun
,
cheese
)
ift
.
extra
.
consistency_check
(
op
,
dtype
,
dtype
)
@
expand
(
product
(
_h_spaces
+
_p_spaces
+
_pow_spaces
,
[
np
.
float64
,
np
.
complex128
]))
def
testOperatorAdaptor
(
self
,
sp
,
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