Esempio n. 1
0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     x = float(args[0])
     y = float(args[1])
     return (x + y) / (1.0 + x * y)
Esempio n. 2
0
 def __call__(self,*args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" % self.__class__.__name__ )
     p = self.p
     x = float(args[0])
     y = float(args[1])
     return (1.0-p)*min(x,y) + p*(x+y)/2.0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     p = self.p
     x = float(args[0])
     y = float(args[1])
     return 1.0 - min(1.0, pow(pow(1.0 - x, p) + pow(1.0 - y, p), 1.0 / p))
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     p = self.p
     x = float(args[0])
     y = float(args[1])
     return x * y / max(x, y, p)
Esempio n. 5
0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     p = self.p
     x = float(args[0])
     y = float(args[1])
     return 1.0 - log(1.0 + (pow(p, 1.0 - x) - 1.0) *
                      (pow(p, 1.0 - y) - 1.0) / (p - 1.0)) / log(p)
Esempio n. 6
0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     p = self.p
     x = float(args[0])
     y = float(args[1])
     if x == 0. or y == 0.:
         return 0. if p != 1. else (x or y)
     return x * y * pow((x + y) / (x * y) - 1, p)
Esempio n. 7
0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     p = self.p
     x = float(args[0])
     y = float(args[1])
     if p == 0. and x * y == 1.:
         return 1.
     return (x + y - x * y - (1.0 - p) * x * y) / (1.0 - (1.0 - p) * x * y)
Esempio n. 8
0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     p = self.p
     x = float(args[0])
     y = float(args[1])
     xp = pow(1 - x, p)
     yp = pow(1 - y, p)
     return 1.0 - pow(xp + yp - xp * yp, 1.0 / p)
Esempio n. 9
0
 def __call__(self, *args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" %
                             self.__class__.__name__)
     x = float(args[0])
     y = float(args[1])
     if y == 0.0:
         return x
     if x == 0.0:
         return y
     return 1.0
Esempio n. 10
0
 def __call__(self,*args):
     if len(args) != 2:
         raise NormException("%s is supported only for 2 parameters" % self.__class__.__name__ )
     p = self.p
     x = float(args[0])
     y = float(args[1])
     if 1.-x == 0. or 1.-y == 0.:
         return 1.
     def f(x,p):
         return 1./pow(1.-x,p)
     return 1.0-1.0/pow(f(x,p)+f(y,p)-1.0,1.0/p)
Esempio n. 11
0
    def __call__(self, *args):
        if len(args) != 2:
            raise NormException("%s is supported only for 2 parameters" %
                                self.__class__.__name__)
        p = self.p
        x = float(args[0])
        y = float(args[1])
        if x == 1. or y == 1.:
            return 1.

        def f(x, p):
            return pow(x / (1.0 - x), p)

        return 1.0 - 1.0 / (1.0 + pow(f(x, p) + f(y, p), 1.0 / p))