Yes; but now suppose the lines are very long.  Is there a way to find the signature (I would call it a canonical form) that doesn't require enumerating rotations?  (I haven't found a good way yet).

Henry Rich

On 2/13/2019 12:16 PM, Roger Hui wrote:
For each row, find a "signature", then find the nub sieve of the
signatures.  The signature I use here is the minimum of all possible
rotations.

    signature=: {. @ (/:~) @ (i.@# |."0 1 ])

    ~: signature"1 a
1 1 1 1 1 0 1 1 1 1 1 0




On Wed, Feb 13, 2019 at 8:55 AM R.E. Boss <[email protected]> wrote:

Let the 12 x 20 matrix be defined by
a=: 0 : 0
  1  4  4  1 _4 _4  1  1 _4 _1 _1 _4 _4 _1  4  4 _1 _1  4  1
  1  4  4  1 _4 _4  1  1 _4 _1 _1 _4 _4 _1  4  1  4 _1 _1  4
  1  4  4  1 _4 _1 _4  1  1 _4 _1 _4 _4 _1  4  1  4 _1 _1  4
  4  1  1  4 _1  4  1 _4 _4  1 _4 _1 _1 _4  1 _4 _1  4  4 _1
  4  1  1  4 _1  4  1 _4 _4  1  1 _4 _1 _1 _4 _4 _1  4  4 _1
_1  4  1  1  4  4  1 _4 _4  1  1 _4 _1 _1 _4 _4 _1  4  4 _1
_1  4  4 _1 _4 _4 _1 _1 _4  1  1 _4 _4  1  4  4  1  1  4 _1
_1  4  4 _1 _4 _4 _1 _1 _4  1  1 _4 _4  1  4 _1  4  1  1  4
_1  4  4 _1 _4  1 _4 _1 _1 _4  1 _4 _4  1  4 _1  4  1  1  4
  4 _1 _1  4  1  4 _1 _4 _4 _1 _4  1  1 _4 _1 _4  1  4  4  1
  4 _1 _1  4  1  4 _1 _4 _4 _1 _1 _4  1  1 _4 _4  1  4  4  1
  1  4 _1 _1  4  4 _1 _4 _4 _1 _1 _4  1  1 _4 _4  1  4  4  1
)

Required is the nubsieve for the items modulo rotation.
So two arrays are considered to be equal if one is a rotation of the other.

The answer I found is
1 1 1 1 1 0 1 1 1 1 1 0


R.E. Boss
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm


---
This email has been checked for viruses by AVG.
https://www.avg.com

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to