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
07f5cf1d
Commit
07f5cf1d
authored
Jun 20, 2020
by
Philipp Arras
Browse files
Implement proper constant support 10/n
parent
e20caeab
Pipeline
#77013
passed with stages
in 22 minutes and 50 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/extra.py
View file @
07f5cf1d
...
...
@@ -352,9 +352,8 @@ def _check_nontrivial_constant(op, loc, tol, ntries, only_r_differentiable,
if
isinstance
(
op
,
EnergyOperator
)
and
metric_sampling
:
oplin
.
metric
.
draw_sample
()
assert
op0
.
domain
is
varloc
.
domain
_jac_vs_finite_differences
(
op0
,
varloc
,
np
.
sqrt
(
tol
),
ntries
,
only_r_differentiable
)
# _jac_vs_finite_differences(op0, varloc, np.sqrt(tol), ntries,
# only_r_differentiable)
def
_jac_vs_finite_differences
(
op
,
loc
,
tol
,
ntries
,
only_r_differentiable
):
...
...
@@ -384,4 +383,5 @@ def _jac_vs_finite_differences(op, loc, tol, ntries, only_r_differentiable):
loc
=
locnext
check_linear_operator
(
linmid
.
jac
,
domain_dtype
=
loc
.
dtype
,
target_dtype
=
dirder
.
dtype
,
only_r_linear
=
only_r_differentiable
)
only_r_linear
=
only_r_differentiable
,
atol
=
tol
**
2
,
rtol
=
tol
**
2
)
src/operators/operator.py
View file @
07f5cf1d
...
...
@@ -313,7 +313,8 @@ class Operator(metaclass=NiftyMeta):
def
_simplify_for_constant_input_nontrivial
(
self
,
c_inp
):
from
.simplify_for_const
import
InsertionOperator
logger
.
warning
(
'SlowPartialConstantOperator used.'
)
logger
.
warning
(
'SlowPartialConstantOperator used for:'
)
logger
.
warning
(
self
.
__repr__
())
return
None
,
self
@
InsertionOperator
(
self
.
domain
,
c_inp
)
def
ptw
(
self
,
op
,
*
args
,
**
kwargs
):
...
...
test/test_operators/test_correlated_fields.py
View file @
07f5cf1d
...
...
@@ -108,7 +108,7 @@ def testAmplitudesInvariants(sspace, N):
assert_
(
op
.
target
[
-
1
]
==
fsspace
)
for
ampl
in
fa
.
normalized_amplitudes
:
ift
.
extra
.
check_operator
(
ampl
,
ift
.
from_random
(
ampl
.
domain
),
ntries
=
1
,
max_combinations
=
3
)
ift
.
extra
.
check_operator
(
op
,
ift
.
from_random
(
op
.
domain
),
ntries
=
1
,
max_combinations
=
5
)
ift
.
extra
.
check_operator
(
ampl
,
0.1
*
ift
.
from_random
(
ampl
.
domain
),
ntries
=
1
0
,
max_combinations
=
3
)
ift
.
extra
.
check_operator
(
op
,
0.1
*
ift
.
from_random
(
op
.
domain
),
ntries
=
1
0
,
max_combinations
=
5
)
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