Returns all symmetry operations (including inversions and
        subtranslations), but unlike get_symop(), they are returned as
        two ndarrays.
163420
def get_op(self):
        """"""
        if self.centrosymmetric:
            rot = np.tile(np.vstack((self.rotations, -self.rotations)), 
                          (self.nsubtrans, 1, 1))
            trans = np.repeat(self.subtrans, 2*len(self.rotations), axis=0)
        else:
            rot = np.tile(self.rotations, (self.nsubtrans, 1, 1))
            trans = np.repeat(self.subtrans, len(self.rotations), axis=0)
        return rot, trans
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)
1168296
def symmetrize(self, method=None, copy=False):
    ''''''
    if copy:
      return SymmEdgePairGraph(self._pairs.copy(),
                               num_vertices=self._num_vertices)
    shape = (self._num_vertices, self._num_vertices)
    flat_inds = np.union1d(np.ravel_multi_index(self._pairs.T, shape),
                           np.ravel_multi_index(self._pairs.T[::-1], shape))
    self._pairs = np.transpose(np.unravel_index(flat_inds, shape))
    return self
499852
def symmetries(self):
        """"""

        symmetry_cycles = set([])
        symmetries = set([])
        for match in GraphSearch(EqualPattern(self))(self):
            match.cycles = match.get_closed_cycles()
            if match.cycles in symmetry_cycles:
                raise RuntimeError("Duplicates in EqualMatch")
            symmetry_cycles.add(match.cycles)
            symmetries.add(match)
        return symmetries
413121
def operator(self):
        
        # is projection the zero operator?
        if self.V.shape[1] == 0:
            N = self.V.shape[0]
            return ZeroLinearOperator((N, N))
        return self._get_operator(self.apply, self.apply_adj)
785567
def symmetry_average(image, symmetry):
    
    img_sym = np.zeros_like(image)
    angle = 360./symmetry
    for i in range(symmetry):
        img_sym += rotateImage(image, angle*i)
    img_sym /= symmetry
    return img_sym
549370
def SymmetricDifference(self, scriptnames):
		''''''
		scriptnames = set(scriptnames)
		myscripts = set(self.scripts.keys())
		return list(scriptnames.difference(myscripts).union(myscripts.difference(scriptnames)))
195394
def geom_find_rotsymm(g, atwts, ax, improp, \
        nmax=_DEF.SYMM_MATCH_NMAX, \
        tol=_DEF.SYMM_MATCH_TOL):
    

    # Imports
    import numpy as np

    # Vectorize the geometry
    g = make_nd_vec(g, nd=None, t=np.float64, norm=False)

    # Ensure a 3-D axis vector
    ax = make_nd_vec(ax, nd=3, t=np.float64, norm=True)

    # Loop downward either until a good axis is found or nval < 1
    #  Should never traverse below n == 1 for regular rotation check;
    #  could for improper, though.
    nval = nmax + 1
    nfac = 1.0
    while nfac > tol and nval > 0:
        nval = nval - 1
        try:
            nfac = geom_symm_match(g, atwts, ax, \
                                    2*np.pi/nval, improp)

        except ZeroDivisionError as zde:
            # If it's because nval == zero, ignore. Else re-raise.
            if nval > 0:
                raise zde
            ## end if
        ## end try
    ## loop

    # Should be good to return
    return nval, nfac
490009
def precompute_sharp_round(nxk, nyk, xc, yc):
    

    # Create arrays for the two- and four-fold symmetry computations:
    s4m = np.ones((nyk,nxk),dtype=np.int16)
    s4m[yc, xc] = 0

    s2m = np.ones((nyk,nxk),dtype=np.int16)
    s2m[yc, xc] = 0
    s2m[yc:nyk, 0:xc]     = -1;
    s2m[0:yc+1, xc+1:nxk] = -1;

    return s2m, s4m
1150047
def symmetrify(A, upper=False):
    
    if use_linalg_cython:
        _symmetrify_cython(A, upper)
    else:
        _symmetrify_numpy(A, upper)
619732
def _extract_array(self, kwargs_list):
        
        lens_model = self._lens_mode_list[0]
        if self._solver_type == 'CENTER':
            center_x = kwargs_list[0]['center_x']
            center_y = kwargs_list[0]['center_y']
            x = [center_x, center_y]
        elif self._solver_type == 'ELLIPSE':
            e1 = kwargs_list[0]['e1']
            e2 = kwargs_list[0]['e2']
            x = [e1, e2]
        elif self._solver_type == 'SHAPELETS':
            coeffs = list(kwargs_list[0]['coeffs'])
            [c10, c01] = coeffs[1: 3]
            x = [c10, c01]
        elif self._solver_type == 'THETA_E_PHI':
            theta_E = kwargs_list[0]['theta_E']
            e1 = kwargs_list[1]['e1']
            e2 = kwargs_list[1]['e2']
            phi_ext, gamma_ext = param_util.ellipticity2phi_gamma(e1, e2)
            x = [theta_E, phi_ext]
        else:
            raise ValueError("Solver type %s not supported for 2-point solver!" % self._solver_type)
        return x
997844
def hessian(self):
        
        return [[[sympy.diff(partial_dv, param) for param in self.params]
                 for partial_dv in comp] for comp in self.jacobian]
979770
def array_inverse(A):
    
    A = np.ascontiguousarray(A, dtype=float)
    b = np.identity(A.shape[2], dtype=A.dtype)

    n_eq = A.shape[1]
    n_rhs = A.shape[2]
    pivots = np.zeros(n_eq, np.intc)
    identity  = np.eye(n_eq)
    def lapack_inverse(a):
        b = np.copy(identity)
        pivots = np.zeros(n_eq, np.intc)
        results = np.linalg.lapack_lite.dgesv(n_eq, n_rhs, a, n_eq, pivots, b, n_eq, 0)
        if results['info'] > 0:
            raise np.linalg.LinAlgError('Singular matrix')
        return b

    return np.array([lapack_inverse(a) for a in A])
382194
def inverse(self):
        
        inv_rotation = self.rotation.T
        inv_translation = np.dot(-self.rotation.T, self.translation)
        return RigidTransform(inv_rotation, inv_translation,
                              from_frame=self._to_frame,
                              to_frame=self._from_frame)
89714
def de_projection_3d(amplitudes, sigmas):
    
    amplitudes_3d = amplitudes / sigmas / np.sqrt(2*np.pi)
    return amplitudes_3d, sigmas
926121
def get_hall_number_from_symmetry(rotations, translations, symprec=1e-5):
    

    r = np.array(rotations, dtype='intc', order='C')
    t = np.array(translations, dtype='double', order='C')
    hall_number = spg.hall_number_from_symmetry(r, t, symprec)
    return hall_number
302153
def funTransSectY(theta, rho):
    
    return np.matrix([[1, rho * theta], [0, 1]], dtype=np.double)