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
ba7cd26a
Commit
ba7cd26a
authored
May 27, 2020
by
Philipp Arras
Browse files
Fixups
parent
c73b4467
Pipeline
#75653
failed with stages
in 13 minutes
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/operators/sum_operator.py
View file @
ba7cd26a
...
...
@@ -224,8 +224,8 @@ class SumOperator(LinearOperator):
fullop
=
op
if
fullop
is
None
else
fullop
+
op
return
None
,
fullop
from
.
operator
import
_
ConstCollector
cc
=
_
ConstCollector
()
from
.
simplify_for_const
import
ConstCollector
cc
=
ConstCollector
()
fullop
=
None
for
tf
,
to
,
n
in
zip
(
f
,
o
,
self
.
_neg
):
cc
.
add
(
tf
,
to
.
target
)
...
...
test/test_operators/test_simplification.py
View file @
ba7cd26a
...
...
@@ -22,18 +22,18 @@ from ..common import setup_function, teardown_function
def
test_simplification
():
from
nifty6.operators.
operator
import
_
ConstantOperator
from
nifty6.operators.
simplify_for_const
import
ConstantOperator
f1
=
ift
.
Field
.
full
(
ift
.
RGSpace
(
10
),
2.
)
op
=
ift
.
FFTOperator
(
f1
.
domain
)
_
,
op2
=
op
.
simplify_for_constant_input
(
f1
)
assert_equal
(
isinstance
(
op2
,
_
ConstantOperator
),
True
)
assert_equal
(
isinstance
(
op2
,
ConstantOperator
),
True
)
assert_allclose
(
op
(
f1
).
val
,
op2
(
f1
).
val
)
dom
=
{
"a"
:
ift
.
RGSpace
(
10
)}
f1
=
ift
.
full
(
dom
,
2.
)
op
=
ift
.
FFTOperator
(
f1
.
domain
[
"a"
]).
ducktape
(
"a"
)
_
,
op2
=
op
.
simplify_for_constant_input
(
f1
)
assert_equal
(
isinstance
(
op2
,
_
ConstantOperator
),
True
)
assert_equal
(
isinstance
(
op2
,
ConstantOperator
),
True
)
assert_allclose
(
op
(
f1
).
val
,
op2
(
f1
).
val
)
dom
=
{
"a"
:
ift
.
RGSpace
(
10
),
"b"
:
ift
.
RGSpace
(
5
)}
...
...
@@ -45,7 +45,7 @@ def test_simplification():
op
=
(
o1
.
ducktape
(
"a"
).
ducktape_left
(
"a"
)
+
o2
.
ducktape
(
"b"
).
ducktape_left
(
"b"
))
_
,
op2
=
op
.
simplify_for_constant_input
(
f2
)
assert_equal
(
isinstance
(
op2
.
_op1
,
_
ConstantOperator
),
True
)
assert_equal
(
isinstance
(
op2
.
_op1
,
ConstantOperator
),
True
)
assert_allclose
(
op
(
f1
)[
"a"
].
val
,
op2
(
f1
)[
"a"
].
val
)
assert_allclose
(
op
(
f1
)[
"b"
].
val
,
op2
(
f1
)[
"b"
].
val
)
lin
=
ift
.
Linearization
.
make_var
(
ift
.
MultiField
.
full
(
op2
.
domain
,
2.
),
True
)
...
...
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