Hmm, you just want the keys: rotate each row so that the minimum item is
first.

   (n i."_1 <./"1 n)|."_1 n
1 3 2 4
1 2 3 4
1 2 3 4
1 3 2 4
1 3 2 4
1 2 3 4
1 2 3 4
1 3 2 4


On Sat, May 16, 2020 at 5:11 PM Roger Hui <rogerhui.can...@gmail.com> wrote:

>    ((n i."_1 <./"1 n)|."_1 n) </. n
> ┌───────┬───────┐
> │2 4 1 3│2 3 4 1│
> │3 2 4 1│3 4 1 2│
> │1 3 2 4│4 1 2 3│
> │4 1 3 2│1 2 3 4│
> └───────┴───────┘
>
> Rotate each row so that the minimum item is first, then use those rotated
> rows as keys.
>
>
> On Sat, May 16, 2020 at 4:44 PM Skip Cave <s...@caveconsulting.com> wrote:
>
>> I have run across this issue a few times in the past.
>> The following 8x4 array has several rows that are 'rotational duplicates'.
>>
>> ]n=.8 4$2 4 1 3 2 3 4 1 3 4 1 2 3 2 4 1 1 3 2 4 4 1 2 3 1 2 3 4 4 1 3 2
>>
>> 2 4 1 3
>>
>> 2 3 4 1
>>
>> 3 4 1 2
>>
>> 3 2 4 1
>>
>> 1 3 2 4
>>
>> 4 1 2 3
>>
>> 1 2 3 4
>>
>> 4 1 3 2
>>
>>
>> Is it possible to develop a verb that would find the rows that are
>> rotational duplicates of each other. That is, find all the rows that would
>> be the same, if each row was rotated some integer value in the first
>> dimension. The output of the verb would be the same shape array, but with
>> each duplicate row rotated such that they show as identical. Picking the
>> 'standard' rotation for a set of rotational duplicates is up to the
>> implementer.
>>
>>
>> Skip
>> ----------------------------------------------------------------------
>> 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