Actually, I think that by calling "conjugacy_classes_representatives" conjugacy classes are already computed, so didn't want to do all the work twice. A possible improvement of the algorithm could be something like this:
def conjugacy_classes(G): classes = [] G_set = Set(G) while len(G_set)!=0: g = G_set[0] cg = conjugacy_class(G,g) classes.append(cg) G_set = G_set.symmetric_difference(cg) return Set(classes) but since I am not a group theorist, I don't know if there is a better algorithm out there, so I assumed that GAP function would be more efficient than anything I could possibly come up with, that's why I was asking if there was a native SAGE wrapping of it. Concerning the math, I need the conjugacy classes as sets in order to compute some invariants given by noncommutative geometry, where bicovariant differential calculi over (the Hopf algebra of) finite groups are in 1-1 correspondence with (unions of) conjugacy classes satisfying certain properties. My hope is that the NC invariants yield some information about the group itself, and am trying to compute a number of examples to get some intuition on what's going on. Anyway, I got first version of my program running and was able to compute things for a dozen not-so-small groups without much trouble, so I guess what I have might do the trick for now. Thank you all for your help! Cheers Javier On Apr 15, 9:04 pm, David Joyner <wdjoy...@gmail.com> wrote: > I don't see how conjugacyclass can be done more efficiently. > Of course, > > def conjugacyclasses(group): > return Set([conjugacyclass(group, g) for g in group]) > > should really be > > def conjugacyclasses(group): > reps = group.conjugacy_classes_representatives() > return Set([conjugacyclass(group, g) for g in reps]) > > But really even this is impossible to do fast for large groups. > For computational problems involving permutation groups, my > understanding was that you should generally try very hard to > only deal with *representatives* of conjugacy classes, but > the original question seemed to indicate he didn't want to use > that command for some reason. > > Maybe I'm misunderstanding something? > > > > > - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---