Skip to content
GitLab
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
80eae8ba
Commit
80eae8ba
authored
Jun 21, 2020
by
Philipp Arras
Browse files
Docstrings, formatting and cleanup
parent
c16036e2
Pipeline
#77016
passed with stages
in 12 minutes and 21 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/extra.py
View file @
80eae8ba
...
...
@@ -114,14 +114,16 @@ def check_operator(op, loc, tol=1e-12, ntries=100, perf_check=True,
If op is an EnergyOperator, metric_sampling determines whether the
test shall try to sample from the metric or not.
max_combinations : Integer
FIXME
The maximum number of combinations of keys which shall be used for
checking partially constant operator and its derivative.
"""
if
not
isinstance
(
op
,
Operator
):
raise
TypeError
(
'This test tests only linear operators.'
)
_domain_check_nonlinear
(
op
,
loc
)
_performance_check
(
op
,
loc
,
bool
(
perf_check
))
_linearization_value_consistency
(
op
,
loc
)
_jac_vs_finite_differences
(
op
,
loc
,
np
.
sqrt
(
tol
),
ntries
,
only_r_differentiable
)
_jac_vs_finite_differences
(
op
,
loc
,
np
.
sqrt
(
tol
),
ntries
,
only_r_differentiable
)
_check_nontrivial_constant
(
op
,
loc
,
tol
,
ntries
,
only_r_differentiable
,
metric_sampling
,
max_combinations
)
...
...
test/test_operators/test_simplification.py
View file @
80eae8ba
...
...
@@ -22,12 +22,6 @@ from nifty7.operators.simplify_for_const import ConstantOperator
def
test_simplification
():
# f1 = ift.Field.full(ift.RGSpace(10), 2.)
# op = ift.FFTOperator(f1.domain)
# _, op2 = op.simplify_for_constant_input(f1)
# assert_(isinstance(op2, ConstantOperator))
# assert_allclose(op(f1).val, op2.force(f1).val)
dom
=
{
"a"
:
ift
.
RGSpace
(
10
)}
f1
=
ift
.
full
(
dom
,
2.
)
op
=
ift
.
FFTOperator
(
f1
.
domain
[
"a"
]).
ducktape
(
"a"
)
...
...
@@ -46,3 +40,4 @@ def test_simplification():
_
,
op2
=
op
.
simplify_for_constant_input
(
f2
)
assert_allclose
(
op
(
f1
)[
"a"
].
val
,
op2
.
force
(
f1
)[
"a"
].
val
)
assert_allclose
(
op
(
f1
)[
"b"
].
val
,
op2
.
force
(
f1
)[
"b"
].
val
)
# FIXME Add test for ChainOperator._simplify_for_constant_input_nontrivial()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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