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
c945025d
Commit
c945025d
authored
Mar 22, 2020
by
Martin Reinecke
Browse files
temporary
parent
9fdb14a2
Pipeline
#71175
failed with stages
in 11 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty6/extra.py
View file @
c945025d
...
...
@@ -278,17 +278,21 @@ def check_jacobian_consistency(op, loc, tol=1e-8, ntries=100, perf_check=True):
dir
=
loc2
-
loc
locnext
=
loc2
dirnorm
=
dir
.
norm
()
hist
=
[]
for
i
in
range
(
50
):
locmid
=
loc
+
0.5
*
dir
linmid
=
op
(
Linearization
.
make_var
(
locmid
))
dirder
=
linmid
.
jac
(
dir
)
numgrad
=
(
lin2
.
val
-
lin
.
val
)
xtol
=
tol
*
dirder
.
norm
()
/
np
.
sqrt
(
dirder
.
size
)
hist
.
append
((
numgrad
-
dirder
).
norm
())
# print(len(hist),hist[-1])
if
(
abs
(
numgrad
-
dirder
)
<=
xtol
).
s_all
():
break
dir
=
dir
*
0.5
dirnorm
*=
0.5
loc2
,
lin2
=
locmid
,
linmid
else
:
print
(
hist
)
raise
ValueError
(
"gradient and value seem inconsistent"
)
loc
=
locnext
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