예제 #1
0
 def __call__(self, *args):
     while type(args[0]) is list: args = args[0]
     assert len(args) == 1
     
     x = args[0]
     if isinstance(x, expr):
         return expr(self, [x])
     return math.fabs(x)
예제 #2
0
 def __call__(self, *args):
     while type(args[0]) is list: args = args[0]
     assert len(args) == 1
     
     x = args[0]
     if isinstance(x, expr):
         return expr(self, [x])
     if x > 0.0: return x
     return 0.0
예제 #3
0
파일: abs.py 프로젝트: winny12/subgradpy
    def __call__(self, *args):
        while type(args[0]) is list:
            args = args[0]
        assert len(args) == 1

        x = args[0]
        if isinstance(x, expr):
            return expr(self, [x])
        return math.fabs(x)
예제 #4
0
    def __call__(self, *args):
        while type(args[0]) is list:
            args = args[0]
        assert len(args) == 1

        x = args[0]
        if isinstance(x, expr):
            return expr(self, [x])
        if x > 0.0: return x
        return 0.0