Convenience function which returns the unit vector aligned
    with the miller index.
350812
def get_mi_vec(slab):
    
    mvec = np.cross(slab.lattice.matrix[0], slab.lattice.matrix[1])
    return mvec / np.linalg.norm(mvec)
1051365
def getUs(classname, eta_s, f, alpha_s, alpha_e, m_u, m_d, m_s, m_c, m_b, m_e, m_mu, m_tau):
    """"""
    w, v = admeig(classname, f, m_u, m_d, m_s, m_c, m_b, m_e, m_mu, m_tau)
    b0s = 11 - 2 * f / 3
    a = w / (2 * b0s)
    return v @ np.diag(eta_s**a) @ np.linalg.inv(v)
606280
def MAU(self):
        ''''''
        if self._MAU is None:
            self._MAU = self.linear_system.M * self.AU
        return self._MAU
219890
public IVector getVectorFromColumn(int index) {
        IVector result = new IVector(rows);
        for (int i = 0; i < rows; i++) {
            result.realvector[i] = realmatrix[i][index];
            result.imagvector[i] = imagmatrix[i][index];
        }
        return result;
    }
618325
def get_unit_from_dimensions(dimensions, text):
    """"""
    key = l.get_key_from_dimensions(dimensions)

    try:
        unit = l.DERIVED_UNI[key]
    except KeyError:
        logging.debug(u'\tCould not find unit for: %s', key)
        unit = c.Unit(name=build_unit_name(dimensions),
                      dimensions=dimensions,
                      entity=get_entity_from_dimensions(dimensions, text))

    return unit
175684
def idx(df, index):
    """"""
    if isinstance(df, (pd.DataFrame, pd.Series)):
        return df.iloc[index]
    else:
        return df[index, :]
383205
def _metric_when_multiplied_with_sig_vec(self, sig):
        
        return dot((self.B * self.D**-1.).T * sig, self.B * self.D)
76944
def parameter_vector(self):
        """"""
        return np.array([getattr(self, k) for k in self.parameter_names])
578969
def _call(self, x):
        """"""
        out = x.asarray().ravel()[self._indices_flat]

        if self.variant == 'point_eval':
            weights = 1.0
        elif self.variant == 'integrate':
            weights = getattr(self.domain, 'cell_volume', 1.0)
        else:
            raise RuntimeError('bad variant {!r}'.format(self.variant))

        if weights != 1.0:
            out *= weights

        return out
17025
def _get_distance_scaling_term(self, C, rval, mag):
        
        r_adj = np.sqrt(rval ** 2.0 + C["h"] ** 2.0)
        return (
            (C["c1"] + C["c2"] * (mag - self.CONSTS["Mref"])) *
            np.log10(r_adj / self.CONSTS["Rref"]) -
            (C["c3"] * (r_adj - self.CONSTS["Rref"])))
584466
def escore(self):
        """"""
        hg_pval_thresh = self.escore_pval_thresh or self.pval
        escore_tol = self.escore_tol or mhg_cython.get_default_tol()
        es = mhg_cython.get_xlmhg_escore(
            self.indices, self.N, self.K, self.X, self.L,
            hg_pval_thresh, escore_tol)
        return es
936022
def get_vector(self):
        """"""
        vec = {}
        for dim in ['forbidden', 'required', 'permitted']:
            if self.survey[dim] is None:
                continue
            dim_vec = map(lambda x: (x['tag'], x['answer']), 
                          self.survey[dim])
            vec[dim] = dict(dim_vec)
        return vec
924895
function fgetIndex(unit, pos) {
  return pos2index(pos, idlen(unit), unit.linelen) + Number(unit.start);
}
1271192
def __basis0(self, xi):
        """"""
        return np.where(np.all([self.knot_vector[:-1] <=  xi,
                                xi < self.knot_vector[1:]],axis=0), 1.0, 0.0)
568897
def vector_distance(v1, v2):
    """"""
    dist = 0
    for dim in v1:
        for x in v1[dim]:
            dd = int(v1[dim][x]) - int(v2[dim][x])
            dist = dist + dd**2
    return dist
1012089
def getvector(d,s):
    '''
    
    '''
    return np.array([d[s+"x"],d[s+"y"],d[s+"z"]]);
467447
def _exec_vector(self, a, bd, mask):
        """"""

        npt = bd.shape[0]
        n = self.X_ADJUSTED.shape[0]
        zero_index = None
        zero_value = False

        a_inv = scipy.linalg.inv(a)

        if np.any(np.absolute(bd) <= self.eps):
            zero_value = True
            zero_index = np.where(np.absolute(bd) <= self.eps)

        b = np.zeros((npt, n+1, 1))
        b[:, :n, 0] = - self.variogram_function(self.variogram_model_parameters, bd)
        if zero_value:
            b[zero_index[0], zero_index[1], 0] = 0.0
        b[:, n, 0] = 1.0

        if (~mask).any():
            mask_b = np.repeat(mask[:, np.newaxis, np.newaxis], n+1, axis=1)
            b = np.ma.array(b, mask=mask_b)

        x = np.dot(a_inv, b.reshape((npt, n+1)).T).reshape((1, n+1, npt)).T
        zvalues = np.sum(x[:, :n, 0] * self.Z, axis=1)
        sigmasq = np.sum(x[:, :, 0] * -b[:, :, 0], axis=1)

        return zvalues, sigmasq