[GAP Forum] Re: Sampling elements in conjugacy classes of a
symmetric group
Alexander Hulpke
hulpke at math.colostate.edu
Wed Feb 4 16:18:09 GMT 2009
Don King wrote:
> I`d like to sample some elements in a symmetric group of order n
> based on the ratio of conjugacy classes.
>
> For instance, if a symmetric group just has five conjugacy classes
> (this is just for illustration, not an actual symmetric group),
>
> Class 1: 10 memeber
> Class2: 20 members
> Class3: 30 memebers
> Class4: 20 members
> Class5: 10 memebers
>
> is it possible to pick random samples like 1,2,3,2,1 elements from
> each class based on the ratio of each conjugacy classes ?.
>
> Is there any way to pick random samples from each conjugacy class ?.
If you take all classes of G, this of course is just random sampling
over the whole of G, and
Random(G)
in GAP will do this. If you only have a subset of classes in the list
class, the following commands will produce such weighted random
sampling:
Precompute:
sz:=List(class,sz);
gcd:=Gcd(sz);
sz:=List(sz,x->x/gcd);
sums:=List([1..Length(sz)],x->Sum(sz{[1..x-1]}));
m:=Sum(sz);
Add(sz,m);
Sampling:
r:=Random([1..m]);
p:=First([1..Length(class)],x->sz[x]<r and sz[x+1]>=r);
randelm:=Random(class[p]); # random group element
Best,
Alexander Hulpke
-- Colorado State University, Department of Mathematics,
Weber Building, 1874 Campus Delivery, Fort Collins, CO 80523-1874, USA
email: hulpke at math.colostate.edu, Phone: ++1-970-4914288
http://www.math.colostate.edu/~hulpke
More information about the Forum
mailing list