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
8b9130ea
Commit
8b9130ea
authored
Jun 19, 2020
by
Philipp Arras
Browse files
Update accuracies
parent
7ebacc0d
Pipeline
#76951
passed with stages
in 11 minutes and 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/extra.py
View file @
8b9130ea
...
...
@@ -28,14 +28,14 @@ from .multi_field import MultiField
from
.operators.energy_operators
import
EnergyOperator
from
.operators.linear_operator
import
LinearOperator
from
.operators.operator
import
Operator
from
.sugar
import
from_random
,
full
,
makeDomain
from
.sugar
import
from_random
,
makeDomain
__all__
=
[
"check_linear_operator"
,
"check_operator"
,
"assert_allclose"
]
def
check_linear_operator
(
op
,
domain_dtype
=
np
.
float64
,
target_dtype
=
np
.
float64
,
atol
=
0
,
rtol
=
1e-
7
,
only_r_linear
=
False
):
atol
=
1e-12
,
rtol
=
1e-
12
,
only_r_linear
=
False
):
"""
Checks an operator for algebraic consistency of its capabilities.
...
...
@@ -85,8 +85,7 @@ def check_linear_operator(op, domain_dtype=np.float64, target_dtype=np.float64,
rtol
,
only_r_linear
)
# MR FIXME the default tolerance is extremely small, especially for Jacobian tests
def
check_operator
(
op
,
loc
,
tol
=
1e-8
,
ntries
=
100
,
perf_check
=
True
,
def
check_operator
(
op
,
loc
,
tol
=
1e-12
,
ntries
=
100
,
perf_check
=
True
,
only_r_differentiable
=
True
,
metric_sampling
=
True
):
"""
Performs various checks of the implementation of linear and nonlinear
...
...
@@ -118,7 +117,7 @@ def check_operator(op, loc, tol=1e-8, ntries=100, perf_check=True,
_domain_check_nonlinear
(
op
,
loc
)
_performance_check
(
op
,
loc
,
bool
(
perf_check
))
_linearization_value_consistency
(
op
,
loc
)
_jac_vs_finite_differences
(
op
,
loc
,
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
)
...
...
@@ -350,7 +349,7 @@ def _check_nontrivial_constant(op, loc, tol, ntries, only_r_differentiable,
_allzero
(
samp0
.
extract
(
cstdom
))
_nozero
(
samp0
.
extract
(
vardom
))
_jac_vs_finite_differences
(
op0
,
loc
,
tol
,
ntries
,
only_r_differentiable
)
_jac_vs_finite_differences
(
op0
,
loc
,
np
.
sqrt
(
tol
)
,
ntries
,
only_r_differentiable
)
def
_jac_vs_finite_differences
(
op
,
loc
,
tol
,
ntries
,
only_r_differentiable
):
...
...
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