def sqrtxy(x, y, p): if is_np(x) and is_np(y): new_dim = min_dim(x, y) return np.sqrt( np.square(np.resize(x, new_dim)) + np.square(np.resize(y, new_dim))) / np.sqrt(2.0) return np.sqrt(np.square(x) + np.square(y)) / np.sqrt(2.0)
def inv(x, y, p): if is_np(x): out = np.zeros(x.shape) np.divide(1.0, x, out=out, where=(x != 0.0)) return out else: return x if x == 0 else 1.0 / x
def f_range(x, y, p): if is_np(x): return np.max(x) - np.min(x) - 1 else: return x
def kurtosis(x, y, p): if is_np(x): return scipy.stats.kurtosis(x) else: return x
def skew(x, y, p): if is_np(x): return scipy.stats.skew(x) else: return x
def stddev(x, y, p): if is_np(x): return np.std(x) else: return x
def reverse(x, y, p): if not is_np(x): return x else: return np.copy(x[::-1])
def ypow(x, y, p): if is_np(x) and is_np(y): new_dim = min_dim(x, y) return (np.abs(np.resize(x, new_dim))**np.abs(np.resize(y, new_dim))) return np.abs(x)**np.abs(y)
def mult(x, y, p): if is_np(x) and is_np(y): new_dim = min_dim(x, y) return np.resize(x, new_dim) * np.resize(y, new_dim) return x * y
def aminus(x, y, p): if is_np(x) and is_np(y): new_dim = min_dim(x, y) return np.abs(np.resize(x, new_dim) - np.resize(y, new_dim)) / 2.0 return np.abs(x - y) / 2.0
def add(x, y, p): if is_np(x) and is_np(y): new_dim = min_dim(x, y) return (np.resize(x, new_dim) + np.resize(y, new_dim)) / 2.0 return (x + y) / 2.0
def gt(x, y, p): if is_np(x) and is_np(y): new_dim = min_dim(x, y) return np.resize(x, new_dim) > np.resize(y, new_dim) return x > y