Returns |(X - X2ᵀ)/lengthscales| (L2-norm).
761446
def scaled_euclid_dist(self, X, X2):  # pragma: no cover
        
        warnings.warn('scaled_euclid_dist is deprecated and will be removed '
                      'in GPflow version 1.4.0. For stationary kernels, '
                      'define K_r(r) instead.',
                      DeprecationWarning)
        r2 = self.scaled_square_dist(X, X2)
        return self._clipped_sqrt(r2)
335852
def length(self):
        """"""
        return np.sqrt(np.sum(self**2, axis=1)).view(np.ndarray)
347937
def dKdLen_of_r(self, r, dimCheck, lengthscale):
		
		if (dimCheck == True):
			return (self.variance**(float(1)/self.originalDimensions)) * np.exp(-0.5 * r**2) * (r**2) / (lengthscale**(float(1)/self.originalDimensions))
		else:
			return (self.variance**(float(1)/self.originalDimensions)) * np.exp(-0.5 * r**2) / (lengthscale**(float(1)/self.originalDimensions))
1083608
def distance(self, x, y):
        
        if scipy.sparse.issparse(x):
            return numpy.linalg.norm((x-y).toarray().ravel())
        else:
            return numpy.linalg.norm(x-y)
177961
def normalize(self):
        """"""
        vlength = self.length()

        #Make sure the length isn't 0
        if vlength > 0:
            self.x /= vlength
            self.y /= vlength
            self.z /= vlength
        else:
            return Vector3(0, 0, 0)
574013
def _norm_slice(sl, start, stop):
    """"""
    length = stop - start
    if sl.start is None:
        normstart = 0
    else:
        if sl.start < 0:
            if sl.start < -length:
                normstart = 0
            else:
                normstart = sl.start + length
        else:
            if sl.start > stop:
                normstart = length
            else:
                normstart = sl.start - start
    if sl.stop is None:
        normstop = length
    else:
        if sl.stop < 0:
            if sl.stop < -length:
                normstop = 0
            else:
                normstop = sl.stop + length
        else:
            if sl.stop > stop:
                normstop = length
            else:
                normstop = sl.stop - start
    if normstop < normstart:
        normstop = normstart
    return slice(normstart, normstop)
14118
def length(self, t0=0, t1=1, error=LENGTH_ERROR, min_depth=LENGTH_MIN_DEPTH):
        """"""
        if t0 == 0 and t1 == 1:
            if self._length_info['bpoints'] == self.bpoints() \
                    and self._length_info['error'] >= error \
                    and self._length_info['min_depth'] >= min_depth:
                return self._length_info['length']

        # using scipy.integrate.quad is quick
        if _quad_available:
            s = quad(lambda tau: abs(self.derivative(tau)), t0, t1,
                            epsabs=error, limit=1000)[0]
        else:
            s = segment_length(self, t0, t1, self.point(t0), self.point(t1),
                               error, min_depth, 0)

        if t0 == 0 and t1 == 1:
            self._length_info['length'] = s
            self._length_info['bpoints'] = self.bpoints()
            self._length_info['error'] = error
            self._length_info['min_depth'] = min_depth
            return self._length_info['length']
        else:
            return s
88160
def _maxlength(X):
    
    return np.fromiter((map(lambda x: len(x), X)), dtype=int).max()
594275
def _unscaled_dist(self, X, X2=None):
        
        #X, = self._slice_X(X)
        if X2 is None:
            Xsq = np.sum(np.square(X),1)
            r2 = -2.*tdot(X) + (Xsq[:,None] + Xsq[None,:])
            util.diag.view(r2)[:,]= 0. # force diagnoal to be zero: sometime numerically a little negative
            r2 = np.clip(r2, 0, np.inf)
            return np.sqrt(r2)
        else:
            #X2, = self._slice_X(X2)
            X1sq = np.sum(np.square(X),1)
            X2sq = np.sum(np.square(X2),1)
            r2 = -2.*np.dot(X, X2.T) + (X1sq[:,None] + X2sq[None,:])
            r2 = np.clip(r2, 0, np.inf)
            return np.sqrt(r2)
138937
def normalize(v):
    ''''''
    if 0 == np.linalg.norm(v):
        return v
    return v / np.linalg.norm(v)
1139667
def waveform_length(X):
    '''  '''
    return np.sum(np.abs(np.diff(X, axis=1)), axis=1)
882826
def _call(self, x):
        """"""
        if isinstance(self.domain, ProductSpace):
            norm = PointwiseNorm(self.domain, 2)(x)
        else:
            norm = x.ufuncs.absolute()

        if self.gamma > 0:
            tmp = norm.ufuncs.square()
            tmp *= 1 / (2 * self.gamma)

            index = norm.ufuncs.greater_equal(self.gamma)
            tmp[index] = norm[index] - self.gamma / 2
        else:
            tmp = norm

        return tmp.inner(tmp.space.one())
474707
def noam_norm(x, epsilon=1.0, name=None):
  """"""
  with tf.name_scope(name, default_name="noam_norm", values=[x]):
    shape = x.get_shape()
    ndims = len(shape)
    return (tf.nn.l2_normalize(x, ndims - 1, epsilon=epsilon) * tf.sqrt(
        to_float(shape[-1])))
213890
def l2_batch_normalize(x, epsilon=1e-12, scope=None):
  
  with tf.name_scope(scope, "l2_batch_normalize") as name_scope:
    x_shape = tf.shape(x)
    x = tf.contrib.layers.flatten(x)
    x /= (epsilon + reduce_max(tf.abs(x), 1, keepdims=True))
    square_sum = reduce_sum(tf.square(x), 1, keepdims=True)
    x_inv_norm = tf.rsqrt(np.sqrt(epsilon) + square_sum)
    x_norm = tf.multiply(x, x_inv_norm)
    return tf.reshape(x_norm, x_shape, name_scope)
1110061
def unit_ball_L2(shape):
  
  x = tf.Variable(tf.zeros(shape))
  return constrain_L2(x)
1082079
def feature_scaling(x, xmin, xmax, a=0, b=1):
    ''''''
    return a + float(x - xmin) * (b - a) / (xmax - xmin)
871113
def Norm2(self):
    
    sum = self.x * self.x + self.y * self.y + self.z * self.z
    return math.sqrt(float(sum))