Ah,

The conjugacy_classes script contains code taken from tje first answer to my 
question. I forgot to mention that.

The first reply to my question actually solved my problem, but as people were 
curious about why I wanted to do what I was doing, I pasted all my code to show 
everyone.

Sorry for the confusion.

--- Original Message ---

From: "Marshall Lochbaum" <[email protected]>
Sent: July 11, 2014 1:23 AM
To: [email protected]
Subject: Re: [Jprogramming] Comaring Arrays

I've read the code you gave and now I'm confused about the original
question. conjugacy_classes returns a list of sorted arrays--you can
just compare them with -:"2 . If you had ~.@:(/:~"2) already, what was
to purpose of the original question?

As an aside, I would recommend boxing the conjugacy classes to avoid
padding. You can compare the boxes with = rather than -:"2 .

   conjugacy_classes =: [: ~. <@(/:~)@:conj_class"(_ 1)/~
   conjugacy_classes a4
┌───────┬───────┬───────┬───────┐
│0 1 2 3│0 2 3 1│0 3 1 2│1 0 3 2│
│       │1 3 2 0│1 2 0 3│2 3 0 1│
│       │2 0 1 3│2 1 3 0│3 2 1 0│
│       │3 1 0 2│3 0 2 1│       │
└───────┴───────┴───────┴───────┘

Marshall

On Thu, Jul 10, 2014 at 04:56:08PM +0100, Jon Hough wrote:
> Hi, thanks for replying.
> I already have the unique permutations. What I'm trying to do is "partition" 
> the permutations into sets of similar permutations.
> Permutations are said to be similar if there exists another (a third 
> permutation) which multiplied by the first permutation, then it's inverse 
> multiplied by that result, gives the second permutation. i.e. the first two 
> permutations are conjugate.
> permutations a and b are conjugate (similar) if there exists a third 
> permutation, c, such that
> a = c*b*c^(_1)
> The interesting thing (relatively speaking) is that similar permutations club 
> together. if a and b are conjugate and a and c are conjugate then b and c are 
> also conjugate, so all the permutations are partitioned into a few conjugacy 
> classes, e.g. for all the permutations of seven objects (5040 of them), there 
> are only 15 conjugacy classes. My code is trying to identify those classes.
>
> > Date: Thu, 10 Jul 2014 11:48:21 -0400
> > From: [email protected]
> > To: [email protected]
> > Subject: Re: [Jprogramming] Comaring Arrays
> >
> > I haven't read the code you posted yet, but if you have a list of arrays
> > and want to find the unique permutations, you almost certainly want
> >
> > (#~ [: ~: /:~"_1)
> >
> > . If you can accept a list of sorted arrays as the output (some of which
> > may not be present in sorted form in the original input) rather than the
> > first instance of each equivalence class in the input, you can use
> >
> > ~.@:(/:~"_1)
> >
> > Marshall
> >
> > On Thu, Jul 10, 2014 at 09:07:21AM +0100, Jon Hough wrote:
> > > The following two 4x4 arrays are rearrangements of each other's rows.
> > >
> > >
> > > 3 2 1 0
> > >
> > >
> > >
> > > 1 0 3 2
> > >
> > >
> > >
> > > 2 3 0 1
> > >
> > >
> > >
> > > 0 0 0 0
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > 2 3 0 1
> > >
> > >
> > >
> > > 3 2 1 0
> > >
> > >
> > >
> > > 1 0 3 2
> > >
> > >
> > >
> > > 0 0 0 0
> > >
> > >
> > > I would like to know a way to acknowledge two arrays as being 
> > > rearrangements of each other. Eventually my goal is to compare long lists 
> > > of such arrays and nub out duplicates - duplicates being rearrangements.
> > >
> > >
> > > The only way I can think to do this is to cycle through all permutations 
> > > of the row of one of the arrays and test for equality with the other 
> > > array, using A. . Of course, there are 24 permutations to test for 4x4 
> > > arrays, but obviously for bigger arrays things get worse.
> > >
> > >
> > > Is there a faster way to check two arrays are (ignoring row permutations) 
> > > equivalent?
> > >
> > >
> > >
> > >
> > >
> > > ----------------------------------------------------------------------
> > > For information about J forums see http://www.jsoftware.com/forums.htm
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to