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
42b1e9e8
Commit
42b1e9e8
authored
Oct 17, 2017
by
Martin Reinecke
Browse files
remove starting guesses from constructor; looking for better solutions
parent
e205cd2e
Pipeline
#20014
passed with stage
in 4 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/operators/invertible_operator_mixin.py
View file @
42b1e9e8
...
...
@@ -37,20 +37,13 @@ class InvertibleOperatorMixin(object):
An instance of an Inverter class.
"""
def
__init__
(
self
,
inverter
,
preconditioner
=
None
,
forward_x0
=
None
,
backward_x0
=
None
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
inverter
,
preconditioner
=
None
,
*
args
,
**
kwargs
):
self
.
__inverter
=
inverter
self
.
_preconditioner
=
preconditioner
self
.
__forward_x0
=
forward_x0
self
.
__backward_x0
=
backward_x0
super
(
InvertibleOperatorMixin
,
self
).
__init__
(
*
args
,
**
kwargs
)
def
_times
(
self
,
x
):
if
self
.
__forward_x0
is
not
None
:
x0
=
self
.
__forward_x0
else
:
x0
=
Field
.
zeros
(
self
.
target
,
dtype
=
x
.
dtype
)
x0
=
Field
.
zeros
(
self
.
target
,
dtype
=
x
.
dtype
)
(
result
,
convergence
)
=
self
.
__inverter
(
QuadraticEnergy
(
A
=
self
.
inverse_times
,
b
=
x
,
position
=
x0
),
...
...
@@ -58,11 +51,7 @@ class InvertibleOperatorMixin(object):
return
result
.
position
def
_adjoint_times
(
self
,
x
):
if
self
.
__backward_x0
is
not
None
:
x0
=
self
.
__backward_x0
else
:
x0
=
Field
.
zeros
(
self
.
domain
,
dtype
=
x
.
dtype
)
x0
=
Field
.
zeros
(
self
.
domain
,
dtype
=
x
.
dtype
)
(
result
,
convergence
)
=
self
.
__inverter
(
QuadraticEnergy
(
A
=
self
.
adjoint_inverse_times
,
b
=
x
,
position
=
x0
),
...
...
@@ -70,11 +59,7 @@ class InvertibleOperatorMixin(object):
return
result
.
position
def
_inverse_times
(
self
,
x
):
if
self
.
__backward_x0
is
not
None
:
x0
=
self
.
__backward_x0
else
:
x0
=
Field
.
zeros
(
self
.
domain
,
dtype
=
x
.
dtype
)
x0
=
Field
.
zeros
(
self
.
domain
,
dtype
=
x
.
dtype
)
(
result
,
convergence
)
=
self
.
__inverter
(
QuadraticEnergy
(
A
=
self
.
times
,
b
=
x
,
position
=
x0
),
...
...
@@ -82,11 +67,7 @@ class InvertibleOperatorMixin(object):
return
result
.
position
def
_adjoint_inverse_times
(
self
,
x
):
if
self
.
__forward_x0
is
not
None
:
x0
=
self
.
__forward_x0
else
:
x0
=
Field
.
zeros
(
self
.
target
,
dtype
=
x
.
dtype
)
x0
=
Field
.
zeros
(
self
.
target
,
dtype
=
x
.
dtype
)
(
result
,
convergence
)
=
self
.
__inverter
(
QuadraticEnergy
(
A
=
self
.
adjoint_times
,
b
=
x
,
position
=
x0
),
...
...
Write
Preview
Supports
Markdown
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