Group generation made deterministic.
Former-commit-id: ee2f92e71427c11348e8fad8c8cee2dfa16fd3d8
This commit is contained in:
parent
1d77d76b80
commit
0fb36f1e4c
|
@ -1185,7 +1185,7 @@ cdef class FinitePointGroup:
|
|||
'''Constructs a FinitePointGroup from PointGroupInfo'''
|
||||
# TODO maybe I might use a try..finally statement to avoid leaks
|
||||
# First, generate all basic data from info
|
||||
permlist = list(info.permgroup.elements)
|
||||
permlist = info.deterministic_elemlist()
|
||||
cdef int order = len(permlist)
|
||||
permindices = {perm: i for i, perm in enumerate(permlist)} # 'invert' permlist
|
||||
identity = info.permgroup.identity
|
||||
|
|
|
@ -29,6 +29,15 @@ def grouprep_try(tdict, src, im, srcgens, imgens, immultop = None, imcmp = None)
|
|||
raise ValueError("Homomorphism inconsistency detected")
|
||||
return
|
||||
|
||||
def group_dps_try(elemlist, elem, gens):
|
||||
'''Deterministic group depth-first search'''
|
||||
elemlist.append(elem)
|
||||
for i in range(len(gens)):
|
||||
newelem = elem * gens[i]
|
||||
if newelem not in elemlist:
|
||||
group_dps_try(elemlist, newelem, gens)
|
||||
return
|
||||
|
||||
class SVWFPointGroupInfo: # only for point groups, coz in svwf_rep() I use I_tyty, not I_ptypty or something alike
|
||||
def __init__(self,
|
||||
name,
|
||||
|
@ -60,6 +69,11 @@ class SVWFPointGroupInfo: # only for point groups, coz in svwf_rep() I use I_tyt
|
|||
immultop = None, imcmp = (lambda x, y: x.isclose(y))
|
||||
)
|
||||
|
||||
def deterministic_elemlist(self):
|
||||
thelist = list()
|
||||
group_dps_try(thelist, self.permgroup.identity, self.permgroupgens)
|
||||
return thelist
|
||||
|
||||
def svwf_rep(self, lMax, *rep_gen_func_args, **rep_gen_func_kwargs):
|
||||
'''
|
||||
This method generates full SVWF (reducible) representation of the group.
|
||||
|
@ -85,7 +99,7 @@ class SVWFPointGroupInfo: # only for point groups, coz in svwf_rep() I use I_tyt
|
|||
Generates a string with a chunk of C code with a definition of a qpms_finite_group_t instance.
|
||||
See also groups.h.
|
||||
'''
|
||||
permlist = list(self.permgroup.elements) # all elements ordered
|
||||
permlist = self.deterministic_elemlist()
|
||||
order = len(permlist)
|
||||
permindices = {perm: i for i, perm in enumerate(permlist)} # 'invert' permlist
|
||||
identity = self.permgroup.identity
|
||||
|
|
Loading…
Reference in New Issue