Apply operators to ``x`` and sum.
348362
def _call(self, x, out=None):
        """"""
        if out is None:
            return self.prod_op(x)[0]
        else:
            wrapped_out = self.prod_op.range.element([out], cast=False)
            pspace_result = self.prod_op(x, out=wrapped_out)
            return pspace_result[0]
850466
def sumnum(*args):
    ''''''
    print('%s = %f' % (' + '.join(args), sum(float(arg) for arg in args)))
1178151
def _calculate(numbers, symbols):
        """"""
        if len(numbers) is 1:
            return numbers[0]

        precedence = [[pow], [mul, div], [add, sub]]

        # Find most important operation
        for op_group in precedence:
            for i, op in enumerate(symbols):
                if op in op_group:
                    # Apply operation
                    a = numbers[i]
                    b = numbers[i + 1]
                    result = MathService._applyBinary(a, b, op)
                    new_numbers = numbers[:i] + [result] + numbers[i + 2:]
                    new_symbols = symbols[:i] + symbols[i + 1:]

                    return MathService._calculate(new_numbers, new_symbols)
1153747
def Itaax(mt, x, t):
    
    return (Sx(mt, x) - Sx(mt, x + t)) / Dx(mt, x)
1165499
def Operate(self, values):
    """"""
    for val in values:
      try:
        if self.Operation(val, self.right_operand):
          return True
      except (TypeError, ValueError):
        pass

    return False
474388
def _call(self, x, out=None):
        """"""
        # TODO: add optimization in case an operator appears repeatedly in a
        # row
        if out is None:
            out = self.range.zero()
            for i, j, op in zip(self.ops.row, self.ops.col, self.ops.data):
                out[i] += op(x[j])
        else:
            has_evaluated_row = np.zeros(len(self.range), dtype=bool)
            for i, j, op in zip(self.ops.row, self.ops.col, self.ops.data):
                if not has_evaluated_row[i]:
                    op(x[j], out=out[i])
                else:
                    # TODO: optimize
                    out[i] += op(x[j])

                has_evaluated_row[i] = True

            for i, evaluated in enumerate(has_evaluated_row):
                if not evaluated:
                    out[i].set_zero()

        return out
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)
370252
def Lookup(self, x):
        """"""
        return self._Bisect(x, self.xs, self.ys)
781548
def ex(mt, x):
    
    sum1 = 0
    for j in mt.lx[x + 1:-1]:
        sum1 += j
        #print sum1
    try:
        return sum1 / mt.lx[x] + 0.5
    except:
        return 0
207880
def _call(self, x):
        """"""
        x_norm = self.pointwise_norm(x).ufuncs.max()

        if x_norm > 1:
            return np.inf
        else:
            return 0
905320
def _calculateXi(self, r):
        
        a = self._a
        return  (r - a)/(r + a)
23311
def multiply(self, other):
        """"""
        return self.operation(other, lambda x, y: x * y)
712898
def _call(self, x, out=None):
        """"""
        if out is None:
            out = self.range.element()

        ndim = self.range.ndim
        dx = self.range.cell_sides

        tmp = np.empty(out.shape, out.dtype, order=out.space.default_order)
        with writable_array(out) as out_arr:
            for axis in range(ndim):
                finite_diff(x[axis], axis=axis, dx=dx[axis],
                            method=self.method, pad_mode=self.pad_mode,
                            pad_const=self.pad_const,
                            out=tmp)
                if axis == 0:
                    out_arr[:] = tmp
                else:
                    out_arr += tmp

        return out
1183070
def _call(self, x, out=None):
        """"""
        if out is None:
            out = self.range.element()
        out.lincomb(self.a, x[0], self.b, x[1])
        return out
555525
def prox_xline(x, step):
    """"""
    if not np.isscalar(x):
        x= x[0]
    if x > 0.5:
        return np.array([0.5])
    else:
        return np.array([x])
70118
def diffpow(self, x, rot=0):
        """"""
        N = len(x)
        if rot:
            x = rotate(x)
        return sum(np.abs(x)**(2. + 4.*np.arange(N) / (N - 1.)))**0.5
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)