Calc `x` to nearest multiple of `mult`.
172597
def _round_multiple(x:int, mult:int=None)->int:
    ""
    return (int(x/mult+0.5)*mult) if mult is not None else x
1271544
def K(self, X, X2, target):
        """"""
        if (X2 is None) or (X2 is X):
            target[np.diag_indices_from(target)] += self._Kdiag(X)
1372707
def approximate_split(x, num_splits, axis=0):
  
  size = shape_list(x)[axis]
  size_splits = [tf.div(size + i, num_splits) for i in range(num_splits)]
  return tf.split(x, size_splits, axis=axis)
1307600
def Mult(self, x, factor):
        
        self.d[x] = self.d.get(x, 0) * factor
1018889
def taax(mt, x, t, m=1):
    
    return mt.Nx[x + t] / mt.Dx[x] - ((float(m - 1) / float(m * 2)) * (1 - nEx(mt, x, t)))
1153679
def cnst_A(self, X):
        
        """

        return np.concatenate(
            [sl.Gax(X, ax)[..., np.newaxis] for ax in self.axes] +
            [X[..., np.newaxis],], axis=X.ndim)
938446
def overlap(self, x, j=None):
        """"""

        q = len(self.within(x, j=j))

        return q
476887
def nearest(self, idx):
        """"""
        hi = self.after(idx)
        lo = self.before(idx)
        if hi is None:
            return lo
        if lo is None:
            return hi
        if abs(hi - idx) < abs(lo - idx):
            return hi
        return lo
76014
def lincon(self, x, theta=0.01):
        """"""
        if x[0] < 0:
            return np.NaN
        return theta * x[1] + x[0]
467828
def numberarray(x, shape):
    """"""
    try:
        iter(x)
    except TypeError:
        return numpy.ones(shape) * x
    else:
        return x
207880
def _call(self, x):
        """"""
        x_norm = self.pointwise_norm(x).ufuncs.max()

        if x_norm > 1:
            return np.inf
        else:
            return 0
510727
def _round_to_next_multiple(n, m):
    
    return n if n % m == 0 else n + m - n % m
963802
def find_lt(a, x):
    """"""
    i = bs.bisect_left(a, x)
    if i: return i - 1
    raise ValueError
486570
def Kdiag(self,X,target):
        """"""
        foo = np.zeros((X.shape[0],X.shape[0]))
        self.K(X,X,foo)
        target += np.diag(foo)
589311
def cnst_AT(self, X):
        
        """

        Xf = sl.rfftn(X, axes=self.axes)
        return np.sum(sl.irfftn(np.conj(self.GAf)*Xf, self.axsz,
                                axes=self.axes), axis=self.Y.ndim-1)
303616
def index_nearest(array, value):
    
    idx = (np.abs(array-value)).argmin()
    return idx
303135
def _call(self, x):
        """"""
        return (self.functional(x) +
                self.quadratic_coeff * x.inner(x) +
                x.inner(self.linear_term) + self.constant)