Return magnitude of the vector.
511003
def magnitude(self):
        """"""
        return math.sqrt(
            reduce(lambda x, y: x + y, [x ** 2 for x in self.to_list()])
        )
574673
def _get_val(self, soln, r, c):
        """"""
        for v in range(1, 10):
            if soln[self.X[r, c, v]]:
                return DIGITS[v-1]
        return "X"
354935
def _get_magnitude_term(self, C, mag):
        
        lny = C['C1'] + (C['C3'] * ((8.5 - mag) ** 2.))
        if mag > 6.3:
            return lny + (-C['H'] * C['C5']) * (mag - 6.3)
        else:
            return lny + C['C2'] * (mag - 6.3)
968974
def _K(self, R):
        """"""
        return self._ns * self._N / R / self._sin_alpha
590091
def number(v):
    """"""
    if nodesetp(v):
        v = string(v)
    try:
        return float(v)
    except ValueError:
        return float('NaN')
16817
def moment_magnitude_scalar(moment):
    '''
    
    '''
    if isinstance(moment, np.ndarray):
        return (2. / 3.) * (np.log10(moment) - 9.05)
    else:
        return (2. / 3.) * (log10(moment) - 9.05)
1164346
def sum(self, vector):
        """"""
        return self.from_list(
            [x + vector.vector[i] for i, x in self.to_list()]
        )
1102730
def _D(self, R):
        """"""
        return (0.3 * self._HNn**2 / self._sin_alpha / R
                + self._HNn + R * self._sin_alpha) / (0.3 * self._HNn + R * self._sin_alpha)
702893
def magnitude(self):
    

    return math.sqrt(self.x ** 2 + self.y ** 2 + self.z ** 2 + self.w ** 2)
1262983
def numberp(v):
    """"""
    return (not(isinstance(v, bool)) and
            (isinstance(v, int) or isinstance(v, float)))
1207276
function _magnitudeOf(values) {
  var result = 0;

  for (var i = 0; i < values.length; i++)
      result += values[i] * values[i];

  return Math.sqrt(result);
}
111666
def unit_vector(self):
        """"""
        x = -math.cos(self.rpitch) * math.sin(self.ryaw)
        y = -math.sin(self.rpitch)
        z = math.cos(self.rpitch) * math.cos(self.ryaw)
        return Vector3(x, y, z)
1080138
def get_magnitude_scaling_term(self, C, rup):
        
        m_c = self.CONSTANTS["m_c"]
        if rup.mag <= m_c:
            return C["cSL"] * rup.mag +\
                C["cSL2"] * ((rup.mag - self.CONSTANTS["m_sc"]) ** 2.)
        else:
            return C["cSL"] * m_c +\
               C["cSL2"] * ((m_c - self.CONSTANTS["m_sc"]) ** 2.) +\
               C["dSL"] * (rup.mag - m_c)
630747
def _get_magnitude_vector_properties(catalogue, config):
    ''''''

    mmin = config.get('input_mmin', np.min(catalogue['magnitude']))
    neq = np.float(np.sum(catalogue['magnitude'] >= mmin - 1.E-7))
    return neq, mmin
1066862
def _B(self, R):
        """"""
        HNn_R = self._HNn / R

        return HNn_R / self._sin_alpha * (0.4 * HNn_R / self._sin_alpha + 1)
145077
def dot(self, vec):
        """"""
        if not isinstance(vec, self.__class__):
            raise TypeError('Dot product operand must be a VectorArray')
        if self.nV != 1 and vec.nV != 1 and self.nV != vec.nV:
            raise ValueError('Dot product operands must have the same '
                             'number of elements.')
        return np.sum((getattr(self, d)*getattr(vec, d) for d in self.dims), 1)
155763
def to_vec3(self):
        """"""
        vec3 = Vector3()
        vec3.x = self.x
        vec3.y = self.y
        vec3.z = self.z

        if self.w != 0:
            vec3 /= self.w

        return vec3