Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
a54c890a
Commit
a54c890a
authored
6 years ago
by
Martin Reinecke
Browse files
Options
Downloads
Patches
Plain Diff
fix partial inference with Newton minimizers
parent
c749042e
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
nifty5/minimization/energy_adapter.py
+6
-8
6 additions, 8 deletions
nifty5/minimization/energy_adapter.py
nifty5/operators/diagonal_operator.py
+2
-2
2 additions, 2 deletions
nifty5/operators/diagonal_operator.py
with
8 additions
and
10 deletions
nifty5/minimization/energy_adapter.py
+
6
−
8
View file @
a54c890a
...
...
@@ -4,6 +4,8 @@ from ..compat import *
from
..minimization.energy
import
Energy
from
..linearization
import
Linearization
from
..multi_field
import
MultiField
from
..operators.scaling_operator
import
ScalingOperator
from
..operators.block_diagonal_operator
import
BlockDiagonalOperator
import
numpy
as
np
...
...
@@ -25,14 +27,10 @@ class EnergyAdapter(Energy):
if
len
(
self
.
_constants
)
==
0
:
tmp
=
self
.
_op
(
Linearization
.
make_var
(
self
.
_position
))
else
:
ctmp
=
MultiField
.
from_dict
({
key
:
val
for
key
,
val
in
self
.
_position
.
items
()
if
key
in
self
.
_constants
})
vtmp
=
MultiField
.
from_dict
({
key
:
val
for
key
,
val
in
self
.
_position
.
items
()
if
key
not
in
self
.
_constants
})
lin
=
Linearization
.
make_var
(
vtmp
)
+
Linearization
.
make_const
(
ctmp
)
tmp
=
self
.
_op
(
lin
)
ops
=
[
ScalingOperator
(
0.
if
key
in
self
.
_constants
else
1.
,
dom
)
for
key
,
dom
in
self
.
_position
.
domain
.
items
()]
bdop
=
BlockDiagonalOperator
(
self
.
_position
.
domain
,
tuple
(
ops
))
tmp
=
self
.
_op
(
Linearization
(
self
.
_position
,
bdop
))
self
.
_val
=
tmp
.
val
.
local_data
[()]
self
.
_grad
=
tmp
.
gradient
if
self
.
_controller
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
nifty5/operators/diagonal_operator.py
+
2
−
2
View file @
a54c890a
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment