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
b6ebd0ad
Commit
b6ebd0ad
authored
Nov 18, 2017
by
Martin Reinecke
Browse files
remove accidentally committed file
parent
4fbb6346
Pipeline
#21867
passed with stage
in 4 minutes and 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/operators/inversion_enabler.pymm
deleted
100644 → 0
View file @
4fbb6346
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2017 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
from ..minimization.quadratic_energy import QuadraticEnergy
from ..field import Field
from .linear_operator import LinearOperator
class InversionEnabler(LinearOperator):
def __init__(self, op, inverter, preconditioner=None):
self._op = op
self._inverter = inverter
if preconditioner is None and hasattr(op, "preconditioner"):
self._preconditioner = op.preconditioner
else:
self._preconditioner = preconditioner
super(InversionEnabler, self).__init__()
@property
def domain(self):
return self._op.domain
@property
def target(self):
return self._op.target
@property
def unitary(self):
return self._op.unitary
@property
def op(self):
return self._op
def _operation(self, x, o1, o2, tdom):
try:
res = o1(x)
except NotImplementedError:
x0 = Field.zeros(tdom, dtype=x.dtype)
energy = QuadraticEnergy(A=o2, b=x, position=x0)
r = self._inverter(energy, preconditioner=self._preconditioner)[0]
res = r.position
return res
def _times(self, x):
return self._operation(x, self._op._times,
self._op.inverse_times, self.target)
def _adjoint_times(self, x):
return self._operation(x, self._op._adjoint_times,
self._op._adjoint_inverse_times, self.domain)
def _inverse_times(self, x):
return self._operation(x, self._op._inverse_times,
self._op._times, self.domain)
def _adjoint_inverse_times(self, x):
return self._operation(x, self._op._adjoint_inverse_times,
self._op._adjoint_times, self.target)
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