Skip to content
Snippets Groups Projects
Commit 9483e218 authored by Jakob Knollmueller's avatar Jakob Knollmueller
Browse files

derivative for clip added

parent 37f9b9b6
No related branches found
No related tags found
No related merge requests found
......@@ -7,6 +7,7 @@ from .compat import *
from .field import Field
from .multi_field import MultiField
from .sugar import makeOp
from .operators.scaling_operator import ScalingOperator
class Linearization(object):
......@@ -189,7 +190,14 @@ class Linearization(object):
def clip(self, min=None, max=None):
tmp = self._val.clip(min, max)
tmp2 = makeOp(1.-(tmp == eps))
if (min is None) and (max is None):
tmp2 = ScalingOperator(1,self._val.domain)
elif max is None:
tmp2 = makeOp(1. - (tmp == min))
elif min is None:
tmp2 = makeOp(1. - (tmp == max))
else:
tmp2 = makeOp(1. - (tmp == min) - (tmp == max))
return self.new(tmp, tmp2(self._jac))
def sin(self):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment