Exemplo n.º 1
0
 def __call__(self, x):
     # find appropriate linear segments
     i = find_index(self.lookup, x, hi=self.hi)
     f = self.segments[i]
     # approximate linearly from support point
     # negative overheads make no sense, so avoid them
     return max(0, f(x))
Exemplo n.º 2
0
 def __call__(self, x):
     # find appropriate linear segments
     i = find_index(self.lookup, x, hi=self.hi)
     f = self.segments[i]
     # approximate linearly from support point
     # negative overheads make no sense, so avoid them
     return max(0, f(x))
Exemplo n.º 3
0
 def inverse(self, y):
     i = find_index(self.reverse_lookup, y, hi=self.hi)
     f = self.segments[i]
     return f.inverse(y)