Yes, I forgot to mention that sig3 works on the whole 2-d array.
That's why it performs reasonably well on finding the ~: 0 -type boolean
nub.
Worth noting, perhaps, that It does NOT return canonically rotated
rows in
Henry's sense.
Cheers,
Mike
On 24/02/2019 12:23, [email protected] wrote:
sig3 does not work:
Funny, it works ok on my copy of j807 (and is very fast, well done Mike).
It doesn't find the minimum rotation of a vector though, it directly takes a
matrix and returns the nubsieve of the rows, so it expects a rank 2 argument.
I compared my solution with sigb_LdF and sigi_Ldf of Louis de Forcrand and
sig1_MD and sig2_MD of Mike Day.
Obviously the special cases are easy to win, but they also revealed a bug in
sigi_LdF.
Indeed a {. was missing on the last line:
sigi=: (|.~ 3 : 0)"1
i=. i.#y
for. y do.
if. 1 = #i do. break. end.
i=. i ((= <./)@:{ # [) y
y=. 1|.y
end.
{.i
)
Without it, |. was receiving a vector of length n on the left and so was expecting
its right argument to be of rank n (which never happened when n > 1).
Louis
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm