Commit 3028acad authored by Philipp Arras's avatar Philipp Arras

Add type checks to InversionEnabler

parent 13b65502
Pipeline #52196 passed with stages
in 8 minutes and 8 seconds
......@@ -23,6 +23,7 @@ from ..minimization.iteration_controllers import IterationController
from ..minimization.quadratic_energy import QuadraticEnergy
from ..sugar import full
from .endomorphic_operator import EndomorphicOperator
from .linear_operator import LinearOperator
class InversionEnabler(EndomorphicOperator):
......@@ -47,6 +48,10 @@ class InversionEnabler(EndomorphicOperator):
"""
def __init__(self, op, iteration_controller, approximation=None):
if not isinstance(op, LinearOperator):
raise TypeError('Operator needs to be linear.')
if op.domain is not op.target:
raise TypeError('Operator needs to be endomorphic.')
self._op = op
self._ic = iteration_controller
self._approximation = approximation
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment