Commit 23b0ed81 authored by Martin Reinecke's avatar Martin Reinecke

bug fix

parent 039a629a
Pipeline #29525 passed with stages
in 11 minutes and 47 seconds
...@@ -64,7 +64,7 @@ class ChainOperator(LinearOperator): ...@@ -64,7 +64,7 @@ class ChainOperator(LinearOperator):
opsnew[i] = opsnew[i]._scale(fct) opsnew[i] = opsnew[i]._scale(fct)
fct = 1. fct = 1.
break break
if fct != 1: if fct != 1 or len(opsnew) == 0:
# have to add the scaling operator at the end # have to add the scaling operator at the end
opsnew.append(ScalingOperator(fct, lastdom)) opsnew.append(ScalingOperator(fct, lastdom))
ops = opsnew ops = opsnew
...@@ -83,6 +83,8 @@ class ChainOperator(LinearOperator): ...@@ -83,6 +83,8 @@ class ChainOperator(LinearOperator):
@staticmethod @staticmethod
def make(ops): def make(ops):
ops = tuple(ops) ops = tuple(ops)
if len(ops) == 0:
raise ValueError("ops is empty")
ops = ChainOperator.simplify(ops) ops = ChainOperator.simplify(ops)
if len(ops) == 1: if len(ops) == 1:
return ops[0] return ops[0]
......
...@@ -108,6 +108,8 @@ class SumOperator(LinearOperator): ...@@ -108,6 +108,8 @@ class SumOperator(LinearOperator):
def make(ops, neg): def make(ops, neg):
ops = tuple(ops) ops = tuple(ops)
neg = tuple(neg) neg = tuple(neg)
if len(ops) == 0:
raise ValueError("ops is empty")
if len(ops) != len(neg): if len(ops) != len(neg):
raise ValueError("length mismatch between ops and neg") raise ValueError("length mismatch between ops and neg")
ops, neg = SumOperator.simplify(ops, neg) ops, neg = SumOperator.simplify(ops, neg)
......
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