Commit 49074cd1 authored by Martin Reinecke's avatar Martin Reinecke
Browse files

small improvements

parent 85cb31fc
......@@ -156,6 +156,7 @@ class Linearization(Operator):
return self.new(self._val-other, self._jac, self._metric)
else:
return self.new(self._val+other, self._jac, self._metric)
raise RuntimeError("must not get here")
def __add__(self, other):
return self._myadd(other, False)
......
......@@ -27,6 +27,16 @@ __all__ = ["get_slice_list", "safe_cast", "parse_spaces", "infer_space",
"my_product", "frozendict", "special_add_at", "iscomplextype"]
def assertValue(cond, msg):
if not cond:
raise ValueError(msg)
def assertType(cond, msg):
if not cond:
raise TypeError(msg)
def my_sum(iterable):
return reduce(lambda x, y: x+y, iterable)
......
Supports Markdown
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