Set of bound SymPy symbols contained within the equation.
545809
def bound_symbols(self):
        """"""
        try:
            lhs_syms = self.lhs.bound_symbols
        except AttributeError:
            lhs_syms = set()
        try:
            rhs_syms = self.rhs.bound_symbols
        except AttributeError:
            rhs_syms = set()
        return lhs_syms | rhs_syms
1289444
def cublasSsymm(handle, side, uplo, m, n, alpha, A, lda, B, ldb, beta, C, ldc):
    
    
    status = _libcublas.cublasSsymm_v2(handle,
                                       _CUBLAS_SIDE_MODE[side], 
                                       _CUBLAS_FILL_MODE[uplo], 
                                       m, n, ctypes.byref(ctypes.c_float(alpha)),
                                       int(A), lda, int(B), ldb, 
                                       ctypes.byref(ctypes.c_float(beta)), 
                                       int(C), ldc)
    cublasCheckStatus(status)
53398
def descriptor_for_symbol(self, symbol):
        
        if isinstance(symbol, basestring):
            symbol = sympy.Symbol(symbol)

        try:
            return self._descriptions_dict[symbol]
        except KeyError:
            raise KeyError("Symbol {0!r} not found in left-hand-side of the equations".format(symbol))
27931
def determine_signs(nodes, edges, cutoff=1e-10):
    
    N = len(nodes)
    M = np.zeros((N, N), dtype=float)
    for a, b, w in edges:
        M[a, b] += w
    M = symmetrize(M)

    return get_signs(M, cutoff=cutoff, validate=False)
538936
def all_symbols(self):
        """"""
        if self._all_symbols is None:
            self._all_symbols = self.free_symbols | self.bound_symbols
        return self._all_symbols
1346151
def equation(self):
        
        mat = np.empty((self.nunknowns, self.model.neq))
        rhs = np.zeros(self.nunknowns)  # Needs to be initialized to zero
        for icp in range(self.ncp):
            istart = icp * self.nlayers
            ieq = 0
            for e in self.model.elementlist:
                if e.nunknowns > 0:
                    mat[istart:istart + self.nlayers, ieq:ieq + e.nunknowns] = \
                        e.potinflayers(self.xcin[icp], self.ycin[icp], self.layers, aq=self.aqin) / self.aqin.Tcol - \
                        e.potinflayers(self.xcout[icp], self.ycout[icp], self.layers, aq=self.aqout) / self.aqout.Tcol
                    ieq += e.nunknowns
                else:
                    rhs[istart:istart + self.nlayers] -= \
                        e.potentiallayers(self.xcin[icp], self.ycin[icp], self.layers, aq=self.aqin) / self.aqin.T - \
                        e.potentiallayers(self.xcout[icp], self.ycout[icp], self.layers, aq=self.aqout) / self.aqout.T
        return mat, rhs
692060
def indicator_constraints(self,x):
        
        x = np.atleast_2d(x)
        I_x = np.ones((x.shape[0],1))
        if self.constraints is not None:
            for d in self.constraints:
                try:
                    exec('constraint = lambda x:' + d['constraint'], globals())
                    ind_x = (constraint(x) <= 0) * 1
                    I_x *= ind_x.reshape(x.shape[0],1)
                except:
                    print('Fail to compile the constraint: ' + str(d))
                    raise
        return I_x
968974
def _K(self, R):
        """"""
        return self._ns * self._N / R / self._sin_alpha
1109137
def geom_symm_match(g, atwts, ax, theta, do_refl):
    

    # Imports
    import numpy as np
    from scipy import linalg as spla

    # Convert g and atwts to n-D vectors
    g = make_nd_vec(g, nd=None, t=np.float64, norm=False)
    atwts = make_nd_vec(atwts, nd=None, t=np.float64, norm=False)

    # Ensure proper dimensionality
    if not g.shape[0] == 3 * atwts.shape[0]:
        raise ValueError("Size of 'g' is not 3*size of 'atwts'")
    ## end if

    # Calculate transformed geometry
    gx = symm_op(g, ax, theta, do_refl)

    # Push g to a column vector
    g = g.reshape((g.shape[0],1))

    # Augment g and gx with imaginary atomic weights
    ex_wts = atwts.repeat(3,axis=0).T.reshape((atwts.shape[0]*3,1)) * 1.j
    g = np.add(g, ex_wts)
    gx = np.add(gx, ex_wts)

##        # Define calc as the outer product of the augmented vectors
##        calc = np.dot(g.reshape((g.shape[0],1)), \
##                            np.reciprocal(gx.reshape((1,gx.shape[0]))))
##
##        # Calculate the complex magnitude of each element and take log10,
##        #  then abs again
##        calc = np.abs(np.log10(np.abs(calc)))

    # Expand g and gx as column vectors of coordinates
    calc_g = g.reshape((g.shape[0] // 3, 3))
    calc_gx = gx.reshape((gx.shape[0] // 3, 3))
##
##        # Expand each into a square matrix of identical column vectors
##        calc_g = calc_g.repeat(g.shape[0], axis=1)
##        calc_gx = gx.repeat(gx.shape[0], axis=1)

    # Calc is the absolute distance between the calc-ed values,
    #  scaled by the maximum of the individual atom distances or unity.

    # Calculate the unscaled distances
    calc = [[spla.norm(np.subtract(calc_g[i,:], calc_gx[j,:])) \
                            for j in range(calc_gx.shape[0])] \
                            for i in range(calc_g.shape[0])]

    # Calculate the scale factors
    scale_g = np.array([spla.norm(calc_g[i,:]) for i in \
                range(calc_g.shape[0])]).reshape((calc_g.shape[0],1)) \
                .repeat(calc_g.shape[0], axis=1)
    scale_gx = np.array([spla.norm(calc_gx[j,:]) for j in \
                range(calc_g.shape[0])]).reshape((1,calc_gx.shape[0])) \
                .repeat(calc_gx.shape[0], axis=0)
    scale = np.maximum(np.maximum(scale_g, scale_gx),
                np.ones_like(scale_g, dtype=np.float64))

    # Scale calc
    calc = np.divide(calc, scale)

    # Take the minimum of each row
    mins = np.min(calc, axis=1)

    # Take the maximum of the minima for the final factor
    fac = np.max(mins)

    # Using the atomic weights for checking matching can result in 'fac'
    #  being greater than unity. Return the minimum of fac and unity.
    fac = min(fac, 1.0)
    return fac
238244
def assert_sympy_expressions_equal(expr1, expr2):
    
    if not sympy_expressions_equal(expr1, expr2):
        raise AssertionError("{0!r} != {1!r}".format(expr1, expr2))
995231
def g_subset(g, atwts, atwt,
            digits=_DEF.SYMM_ATWT_ROUND_DIGITS):
    

    # Imports
    import numpy as np

    # Ensure g and atwts are n-D vectors
    g = make_nd_vec(g, nd=None, t=np.float64, norm=False)
    atwts = make_nd_vec(atwts, nd=None, t=np.float64, norm=False)

    # Ensure dims match (should already be checked at object creation...)
    if not (len(g) == 3*len(atwts)):
        raise ValueError("Dim mismatch [len(g) != 3*len(ats)].")
    ## end if

    # Pull into coordinate groups
    co = np.split(g, g.shape[0] // 3)

    # Filter by the indicated atomic weight
    cf = [c for (c,a) in zip(co, atwts) if \
                    np.round(a, digits) == np.round(atwt, digits)]

    # Expand back to single vector, if possible
    if not cf == []:
        g_sub = np.concatenate(cf, axis=0)
        g_sub = g_sub.reshape((g_sub.shape[0],1))
    else:
        g_sub = []
    ## end if

    # Return the subset
    return g_sub
1938
def _symbols():
    
    global _SYMBOLS
    if _SYMBOLS is None:
        tmp = [(s, 'symbol') for s in _data()['symbol'].keys()]
        tmp += [(s, 'alpha3') for s in _data()['alpha3'].keys()]
        tmp += [(s.name, 'name') for s in _data()['alpha3'].values()]
        _SYMBOLS = sorted(
            tmp,
            key=lambda s: (len(s[0]), ord(s[0][0])),
            reverse=True)

    return _SYMBOLS
354681
def ast_to_sympy(expr):
    ''''''
    from dolang import to_source
    s = to_source(expr)
    not_to_be_treated_as_functions = ['alpha','beta', 'gamma','zeta', 'Chi']
    d = {v: sympy.Symbol(v) for v in not_to_be_treated_as_functions}
    return sympy.sympify(s, locals=d)
116724
function step(equation, symbolName) {
  const solveFunctions = [
    // ensure the symbol is always on the left node
    EquationOperations.ensureSymbolInLeftNode,
    // get rid of denominators that have the symbol
    EquationOperations.removeSymbolFromDenominator,
    // remove the symbol from the right side
    EquationOperations.removeSymbolFromRightSide,
    // isolate the symbol on the left side
    EquationOperations.isolateSymbolOnLeftSide,
  ];

  for (let i = 0; i < solveFunctions.length; i++) {
    const equationStatus = solveFunctions[i](equation, symbolName);

    if (equationStatus.hasChanged()) {
      return equationStatus;
    }
  }
  return EquationStatus.noChange(equation);
}
805465
function (m, u) {
        return [
            m[0][0] * u[0] + m[0][1] * u[1] + m[0][2] * u[2],
            m[1][0] * u[0] + m[1][1] * u[1] + m[1][2] * u[2],
            m[2][0] * u[0] + m[2][1] * u[1] + m[2][2] * u[2]
        ];
    }
399161
def get_vectors(self, indices=None):
        ''''''
        H_ = self._deflated_solver.H
        (n_, n) = H_.shape
        coeffs = self.coeffs if indices is None else self.coeffs[:, indices]
        return numpy.c_[self._deflated_solver.V[:, :n],
                        self._deflated_solver.projection.U].dot(coeffs)
441123
def symbolic_part(z, s):
    """
    if s == 1: return symre(z)
    elif s == -1: return symim(z)
    elif s == 0: return z