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
522c81df
Commit
522c81df
authored
Dec 03, 2017
by
Martin Reinecke
Browse files
small tweaks
parent
5cf72d10
Pipeline
#22472
passed with stage
in 4 minutes and 45 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/library/nonlinear_power_energy.py
View file @
522c81df
...
...
@@ -74,7 +74,7 @@ class NonlinearPowerEnergy(Energy):
residual
=
self
.
d
-
\
self
.
Instrument
(
self
.
nonlinearity
(
self
.
FFT
.
adjoint_times
(
self
.
power
*
sample
)))
lh
=
0.5
*
residual
.
vdot
(
self
.
N
.
inverse_times
(
residual
))
.
real
lh
=
0.5
*
residual
.
vdot
(
self
.
N
.
inverse_times
(
residual
))
LinR
=
LinearizedPowerResponse
(
self
.
Instrument
,
self
.
nonlinearity
,
self
.
FFT
,
self
.
Projection
,
self
.
position
,
sample
)
...
...
nifty/minimization/quadratic_energy.py
View file @
522c81df
from
.energy
import
Energy
from
..utilities
import
memo
class
QuadraticEnergy
(
Energy
):
...
...
@@ -13,9 +12,12 @@ class QuadraticEnergy(Energy):
self
.
_A
=
A
self
.
_b
=
b
if
_grad
is
not
None
:
self
.
_Ax
=
_grad
+
self
.
_b
self
.
_grad
=
_grad
Ax
=
_grad
+
self
.
_b
else
:
self
.
_Ax
=
self
.
_A
(
self
.
position
)
Ax
=
self
.
_A
(
self
.
position
)
self
.
_grad
=
Ax
-
self
.
_b
self
.
_value
=
0.5
*
self
.
position
.
vdot
(
Ax
)
-
b
.
vdot
(
self
.
position
)
def
at
(
self
,
position
):
return
QuadraticEnergy
(
position
=
position
,
A
=
self
.
_A
,
b
=
self
.
_b
)
...
...
@@ -25,14 +27,12 @@ class QuadraticEnergy(Energy):
_grad
=
grad
)
@
property
@
memo
def
value
(
self
):
return
0.5
*
self
.
position
.
vdot
(
self
.
_Ax
)
-
self
.
_b
.
vdot
(
self
.
position
)
return
self
.
_value
@
property
@
memo
def
gradient
(
self
):
return
self
.
_
Ax
-
self
.
_b
return
self
.
_
grad
@
property
def
curvature
(
self
):
...
...
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