Roger,

It has been many years since I programmed in APL. My last APL work project
was in 1976-77 designing character recognition algorithms on a Harris
terminal (IBM selectric mechanisms) with an acoustic coupler, using
University Computing Company's IBM Mainframe timesharing in Dallas Texas.
When I discovered J, I was very happy that I could stop having to paste APL
symbol stickers on my keyboard.

It will be interesting to see if I can still remember enough of the APL
symbols to understand your post in the APL chat forum.

Skip Cave
Cave Consulting LLC


On Tue, May 19, 2020 at 10:37 AM Roger Hui <rogerhui.can...@gmail.com>
wrote:

> I have written a lengthier description
> <https://forums.dyalog.com/viewtopic.php?f=30&t=1642> of the solutions in
> the Dyalog APL Chat Forum.  It is in APL rather than J notation, but may be
> helpful.  The main thing to remember is that " (the rank operator) is ⍤ in
> Dyalog APL.
>
>
>
> On Sun, May 17, 2020 at 10:44 PM Skip Cave <s...@caveconsulting.com>
> wrote:
>
> > Roger,
> > The llr versions you provided are interesting and useful. I expect to
> learn
> > much by analysing them.
> >
> > Skip Cave
> >
> >
> >
> > On Sun, May 17, 2020 at 3:09 PM Roger Hui <rogerhui.can...@gmail.com>
> > wrote:
> >
> > > (I posted the following msg which appears not to be distributed.  Not
> yet
> > > in the archive, at least.  Sorry if you receive this more than once.)
> > >
> > > llr0=: {.@(/:~)@(i.@# |."0 1 ])"1
> > >
> > > llr1=: {.@(/:~)@(([: I. ] = <./)|."0 1 ])"1
> > >
> > > llr2=: 3 : 0
> > >  c=. {: $ y
> > >  n=. # y
> > >  (c*i.n) { }."1 /:~ (c#i.n) ,. ((n*c)$i.c) |."_1 c # y
> > > )
> > >
> > > llr3=: 3 : 0
> > >  c=. {: $ y         NB. # columns
> > >  n=. # y            NB. # rows
> > >  r=. >:+:>./|,y     NB. the "radius"
> > >  q=. y + r*i.n      NB. increase each row by the radius
> > >  e=. <./"1 q        NB. minimum in each row
> > >  b=. q=e            NB. where elements equal the minimum
> > >  s=. +/"1 b         NB. # times that happens for each row
> > >  (r*i.n) -~ (}:+/\0,s) { /:~ (c|I.,b) |."_1 s#q
> > > )
> > >
> > > llr0 computes the lexicographically least rotation of all the rotations
> > of
> > > each row.
> > >
> > > llr1 computes the LLR of, each row rotated so that every minimal
> element
> > > gets the chance to be the first element.
> > >
> > > llr2 is llr0 reworked so that the code works on the entire matrix at
> > once,
> > > rather than one row at a time.
> > >
> > > llr3 likewise, llr2 reworked to work on the entire matrix at once.  It
> > > assumes that the maximal element in the entire matrix (needed for the
> > > "radius") is no so large as to consume all available precision.
> > >
> > >    odo=: #: i.@(*/)
> > >    x=: ,.~ ,~ odo 5$5
> > >    $x
> > > 6250 10
> > >
> > >    (llr0 -: llr1) x
> > > 1
> > >    (llr0 -: llr2) x
> > > 1
> > >    (llr0 -: llr3) x
> > > 1
> > >
> > >    timer=: 6!:2
> > >    timer&> 'llr0 x'; 'llr1 x'; 'llr2 x'; 'llr3 x'
> > > 0.0434449 0.0141476 0.0207071 0.00634583
> > >
> > >
> > > 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
> > >
> > ----------------------------------------------------------------------
> > 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