> 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