Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
6007131f
Commit
6007131f
authored
Jan 29, 2019
by
Reimar H Leike
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added docu to the checks
parent
ecedc71f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
8 deletions
+35
-8
nifty5/extra.py
nifty5/extra.py
+35
-8
No files found.
nifty5/extra.py
View file @
6007131f
...
...
@@ -74,25 +74,31 @@ def _check_linearity(op, domain_dtype, atol, rtol):
def
consistency_check
(
op
,
domain_dtype
=
np
.
float64
,
target_dtype
=
np
.
float64
,
atol
=
0
,
rtol
=
1e-7
):
"""Checks whether times(), adjoint_times(), inverse_times() and
"""
Checks an operator for algebraic consistency of its capabilities.
Checks whether times(), adjoint_times(), inverse_times() and
adjoint_inverse_times() (if in capability list) is implemented
consistently. Additionally, it checks whether the operator is linear
actually.
consistently. Additionally, it checks whether the operator is linear.
Parameters
----------
op : LinearOperator
Operator which shall be checked.
domain_dtype :
FIXME
domain_dtype :
dtype
The data type of the random vectors in the operator's domain. Default
is `np.float64`.
target_dtype :
FIXME
target_dtype :
dtype
The data type of the random vectors in the operator's target. Default
is `np.float64`.
atol : float
FIXME. Default is 0.
Absolute tolerance for the check. If rtol is specified,
then satisfying any tolerance will let the check pass.
Default: 0.
rtol : float
FIXME. Default is 0.
Relative tolerance for the check. If atol is specified,
then satisfying any tolerance will let the check pass.
Default: 0.
"""
if
not
isinstance
(
op
,
LinearOperator
):
raise
TypeError
(
'This test tests only linear operators.'
)
...
...
@@ -157,7 +163,28 @@ def _check_consistency(op, loc, tol, ntries, do_metric):
def
check_value_gradient_consistency
(
op
,
loc
,
tol
=
1e-8
,
ntries
=
100
):
"""FIXME"""
"""
Checks the gradient (jacobian) of an operator against its value.
Computes the gradient (jacobian) with finite differences and compares
it to the implemented gradient (jacobian).
Parameters
----------
op : Operator
Operator which shall be checked.
loc : Field or MultiField
An Field or MultiField instance which has the same domain
as op. The location at which the gradient is checked
atol : float
Absolute tolerance for the check. If rtol is specified,
then satisfying any tolerance will let the check pass.
Default: 0.
rtol : float
Relative tolerance for the check. If atol is specified,
then satisfying any tolerance will let the check pass.
Default: 0
"""
_check_consistency
(
op
,
loc
,
tol
,
ntries
,
False
)
...
...
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