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
9cdba817
Commit
9cdba817
authored
Feb 05, 2019
by
Martin Reinecke
Browse files
next round of fixes; should work now (tm)
parent
74737cd0
Pipeline
#43323
passed with stages
in 8 minutes and 3 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/operators/simple_linear_operators.py
View file @
9cdba817
...
...
@@ -189,20 +189,20 @@ def ducktape(left, right, name):
"""
from
..sugar
import
makeDomain
from
.operator
import
Operator
if
isinstance
(
right
,
Operator
):
right
=
right
.
target
elif
right
is
not
None
:
right
=
makeDomain
(
right
)
if
isinstance
(
left
,
Operator
):
left
=
left
.
domain
elif
left
is
not
None
:
left
=
makeDomain
(
left
)
if
left
is
None
:
# need to infer left from right
if
isinstance
(
right
,
Operator
):
right
=
right
.
target
elif
right
is
not
None
:
right
=
makeDomain
(
right
)
if
isinstance
(
right
,
MultiDomain
):
left
=
right
[
name
]
else
:
left
=
MultiDomain
.
make
({
name
:
right
})
else
:
# need to infer right from left
if
isinstance
(
left
,
Operator
):
left
=
left
.
domain
else
:
left
=
makeDomain
(
left
)
elif
right
is
None
:
# need to infer right from left
if
isinstance
(
left
,
MultiDomain
):
right
=
left
[
name
]
else
:
...
...
@@ -218,7 +218,7 @@ def ducktape(left, right, name):
return
_SlowFieldAdapter
(
left
,
name
).
adjoint
if
rmulti
:
if
len
(
right
)
==
1
:
return
FieldAdapter
(
righ
t
,
name
)
return
FieldAdapter
(
lef
t
,
name
)
else
:
return
_SlowFieldAdapter
(
right
,
name
)
raise
ValueError
(
"must not arrive here"
)
...
...
test/test_operators/test_jacobian.py
View file @
9cdba817
...
...
@@ -61,8 +61,8 @@ def testBinary(type1, type2, space, seed):
_make_linearization
(
type2
,
dom2
,
seed
)
dom
=
ift
.
MultiDomain
.
union
((
dom1
,
dom2
))
select_s1
=
ift
.
ducktape
(
None
,
dom
,
"s1"
)
select_s2
=
ift
.
ducktape
(
None
,
dom
,
"s2"
)
select_s1
=
ift
.
ducktape
(
None
,
dom
1
,
"s1"
)
select_s2
=
ift
.
ducktape
(
None
,
dom
2
,
"s2"
)
model
=
select_s1
*
select_s2
pos
=
ift
.
from_random
(
"normal"
,
dom
)
ift
.
extra
.
check_jacobian_consistency
(
model
,
pos
,
ntries
=
20
)
...
...
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