Return the separable sum evaluated in ``x``.
5491
def _call(self, x):
        """"""
        return sum(fi(xi) for xi, fi in zip(x, self.functionals))
178525
def amean(x, weights=None):
    
    w_arr, x_arr = _preprocess_inputs(x, weights)
    return (w_arr*x_arr).sum(axis=0) / w_arr.sum(axis=0)
1223638
def _call(self, x):
        """"""
        if self.exponent == 0:
            return self.domain.one().inner(np.not_equal(x, 0))
        elif self.exponent == 1:
            return x.ufuncs.absolute().inner(self.domain.one())
        elif self.exponent == 2:
            return np.sqrt(x.inner(x))
        elif np.isfinite(self.exponent):
            tmp = x.ufuncs.absolute()
            tmp.ufuncs.power(self.exponent, out=tmp)
            return np.power(tmp.inner(self.domain.one()), 1 / self.exponent)
        elif self.exponent == np.inf:
            return x.ufuncs.absolute().ufuncs.max()
        elif self.exponent == -np.inf:
            return x.ufuncs.absolute().ufuncs.min()
        else:
            raise RuntimeError('unknown exponent')
1362830
def subset_sum(x, R):
    
    b = [False] * (R + 1)
    b[0] = True
    for xi in x:
        for s in range(R, xi - 1, -1):
            b[s] |= b[s - xi]
    return b[R]
699402
def _call(self, x):
        """"""
        x_norm = self.__norm(x)

        if x_norm > 1:
            return np.inf
        else:
            return 0
941518
def sum(self):
        
        return self.mapPartitions(lambda x: [sum(x)]).fold(0, operator.add)
1120441
def sum(a, axis=-1):
    """"""
    d = a.d
    crs = _vector.vector.to_list(a.tt if isinstance(a, _matrix.matrix) else a)
    if axis < 0:
        axis = range(a.d)
    elif isinstance(axis, int):
        axis = [axis]
    axis = list(axis)[::-1]
    for ax in axis:
        crs[ax] = _np.sum(crs[ax], axis=1)
        rleft, rright = crs[ax].shape
        if (rleft >= rright or rleft < rright and ax + 1 >= d) and ax > 0:
            crs[ax - 1] = _np.tensordot(crs[ax - 1], crs[ax], axes=(2, 0))
        elif ax + 1 < d:
            crs[ax + 1] = _np.tensordot(crs[ax], crs[ax + 1], axes=(1, 0))
        else:
            return _np.sum(crs[ax])
        crs.pop(ax)
        d -= 1
    return _vector.vector.from_list(crs)
502498
def _separable_approx2(h, N=1):
    
    return np.cumsum([np.outer(fy, fx) for fy, fx in _separable_series2(h, N)], 0)
939236
def part_sum(x, i=0):
    
    if i == len(x):
        yield 0
    else:
        for s in part_sum(x, i + 1):
            yield s
            yield s + x[i]
115305
def find(self, x):
        
        if self.up[x] == x:
            return x
        else:
            self.up[x] = self.find(self.up[x])
            return self.up[x]
25967
def decker_sum(a, b):
    
    x = a + b
    y = b - (x - a) if abs(a) > abs(b) else a - (x - b)
    return x, y
1160800
def _call(self, x, out=None):
        """"""
        if out is None:
            return self.vector * self.functional(x)
        else:
            scalar = self.functional(x)
            out.lincomb(scalar, self.vector)
681123
def _call(self, x, out=None):
        """"""
        if out is None:
            out = self.scalar * x
        else:
            out.lincomb(self.scalar, x)
        return out
945239
def sum(self, axis=None, keepdims=False):
        
        return self.numpy().sum(axis=axis, keepdims=keepdims)
963802
def find_lt(a, x):
    """"""
    i = bs.bisect_left(a, x)
    if i: return i - 1
    raise ValueError
599086
def function(x, ax, ay):
    '''
    
    '''
    with np.errstate(invalid='ignore'):
        return ay * (x - ax)**0.5
77905
def _evaluate(self,x):
        '''
        
        '''
        if _isscalar(x):
            y = np.nanmin([f(x) for f in self.functions])
        else:
            m = len(x)
            fx = np.zeros((m,self.funcCount))
            for j in range(self.funcCount):
                fx[:,j] = self.functions[j](x)
            y = np.nanmin(fx,axis=1)
        return y