Compute the safe norm.
760108
def _norm(self, x):
    """"""
    return tf.sqrt(tf.reduce_sum(tf.square(x), keepdims=True, axis=-1) + 1e-7)
64815
def NormInt(df,sampleA,sampleB):
    

    c1=df[sampleA]
    c2=df[sampleB]
    return np.log10(np.sqrt(c1*c2))
854620
def norm(A):
    
    return np.sqrt(A.multiply(A).sum(1).A1) if issparse(A) else np.sqrt(np.einsum('ij, ij -> i', A, A))
829424
def apply_matrix_norm(m, v):
    """"""
    (a, b, c, d, e, f) = m
    (p, q) = v
    return (a*p+c*q, b*p+d*q)
1165405
def _norm(self, x):
        
        return float(np.sqrt(self.inner(x, x).real))
480730
protected double norm(double x, int i) {
    if (Double.isNaN(m_Ranges[i][R_MIN]) || (m_Ranges[i][R_MAX] == m_Ranges[i][R_MIN]))
      return 0;
    else
      return (x - m_Ranges[i][R_MIN]) / (m_Ranges[i][R_WIDTH]);
  }
848038
def normcdf(x, mu, sigma):
    
    t = x-mu
    y = 0.5*erfcc(-t/(sigma*math.sqrt(2.0)))
    if y > 1.0:
        y = 1.0
    return y
879891
def lpnormalization(attrs, inputs, proto_obj):
    """"""
    new_attrs = translation_utils._fix_attribute_names(attrs, {'p': 'ord'})
    axis = int(attrs.get("axis", -1))
    new_attrs.update(axis=axis)
    return 'norm', new_attrs, inputs
303228
def _norm_default(x):
    """"""
    # Lazy import to improve `import odl` time
    import scipy.linalg

    if _blas_is_applicable(x.data):
        nrm2 = scipy.linalg.blas.get_blas_funcs('nrm2', dtype=x.dtype)
        norm = partial(nrm2, n=native(x.size))
    else:
        norm = np.linalg.norm
    return norm(x.data.ravel())
714916
def normcdf(x, log=False):
    """"""
    y = np.atleast_1d(x).copy()
    flib.normcdf(y)
    if log:
        if (y>0).all():
            return np.log(y)
        return -np.inf
    return y
699402
def _call(self, x):
        """"""
        x_norm = self.__norm(x)

        if x_norm > 1:
            return np.inf
        else:
            return 0
434493
def norm_squared(x, Mx=None, inner_product=ip_euclid):
    ''''''
    assert(len(x.shape) == 2)
    if Mx is None:
        rho = inner_product(x, x)
    else:
        assert(len(Mx.shape) == 2)
        rho = inner_product(x, Mx)

    if rho.shape == (1, 1):
        if abs(rho[0, 0].imag) > abs(rho[0, 0])*1e-10 or rho[0, 0].real < 0.0:
            raise InnerProductError(('<x,Mx> = %g. Is the inner product '
                                     'indefinite?') % rho[0, 0])

    return numpy.linalg.norm(rho, 2)
178673
def compute(self, x_arr, y_arr):
        '''
        
        '''
        return np.linalg.norm(x_arr - y_arr, axis=-1)
149799
function norm(n, X, incx, offx) {
    // Euclidean norm
    // LAPACK: DNRM2

    if (n === 0.0) {
      return Math.abs(n);
    }

    var scale = 0.0;
    var ssq = 1.0;
    for (var i = 0; i < n; ++i) {
      var xi = X[offx + incx*i];
      if (xi !== 0.0) {
        var absxi = Math.abs(xi);
        if (scale < absxi) {
          var z = scale / absxi;
          ssq = 1.0 + ssq * (z * z);
          scale = absxi;
        } else {
          var z = absxi / scale;
          ssq = ssq + z * z;
        }
      }
    }
    return scale * Math.sqrt(ssq);
  }
636217
def _write_median_norm(self, norms:[])->None:
        ""
        median_norm = statistics.median(norms)
        self._add_gradient_scalar('median_norm', scalar_value=median_norm)
618281
def normalize(u):
    '''
    
    '''
    u = np.asarray(u)
    unorm = np.sqrt(np.sum(u**2, axis=0))
    z = np.isclose(unorm, 0)
    c = np.logical_not(z) / (unorm + z)
    return u * c
436515
def _batch_norm(name, x):
  """"""
  with tf.name_scope(name):
    return tf.contrib.layers.batch_norm(
        inputs=x,
        decay=.9,
        center=True,
        scale=True,
        activation_fn=None,
        updates_collections=None,
        is_training=False)