Thank you, Clifford, for the insightful reformulation! I understand the thought 
process to be find a dyadic u such that u/~ data produces the Euclidean matrix. 
So for parity with my solution +/ @: *:@:-"1 /~ does it. The trickiness - or so 
it seems to me - is that u has to be rank 0 for /~ to apply as expected.

I think the rub is this bit: f=: *:@:-"1

For nouns x and y it unpacks to *: (x -"1 y )

The dyadic form of -"1 makes the whole thing rank 0 by operating on atoms.

Then for x and y again, +/ @: f just unpacks to +/ x f y

I've tried to write this as an explicitly declared verb (i.e. with x and y 
stipulated) but to no avail.

Something like f=: 4 : '*: x (-"1) y' then ed := +/ @: f

... but it clearly fails to be rank 0 for reasons I'm not understanding at the 
moment. Can you give me a clue?

________________________________
From: Programming <[email protected]> on behalf of 
[email protected] 
<[email protected]>
Sent: 14 February 2021 12:00
To: [email protected] <[email protected]>
Subject: Programming Digest, Vol 185, Issue 14

Send Programming mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://jsoftware.com/mailman/listinfo/programming
or, via email, send a message with subject or body 'help' to
        [email protected]

General information about the Jsoftware mailing lists is at:

   https://code.jsoftware.com/wiki/System/Forums

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Programming digest..."


Today's Topics:

   1. Re: k-mediods PAM algo, help with canonical form (Clifford Reiter)
   2. Re: k-mediods PAM algo, help with canonical form
      ('Michael Day' via Programming)
   3. Re: k-mediods PAM algo, help with canonical form (xash)
   4. Re: k-mediods PAM algo, help with canonical form (xash)
   5. Re: Error in comment in addons/math/misc/pollard.ijs
      (Ric Sherlock)
   6. Re: Error in comment in addons/math/misc/pollard.ijs
      ('Mike Day' via Programming)
   7. Re: Error in comment in addons/math/misc/pollard.ijs (Henry Rich)
   8. Re: Error in comment in addons/math/misc/pollard.ijs
      (Ric Sherlock)


----------------------------------------------------------------------

Message: 1
Date: Sat, 13 Feb 2021 08:04:15 -0500
From: Clifford Reiter <[email protected]>
To: programming <[email protected]>
Subject: Re: [Jprogramming] k-mediods PAM algo, help with canonical
        form
Message-ID:
        <CAO=c1srz27e-ykvsaxpxudxqweqm8nm4vsfyzbpj6xmjgl2...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

I will take a stab at the euclidean distance matrix verb. I note that your
edist gives the square of the distance.

+/&.:*: 3 4 NB. euclidean length

5

ed=:+/&.:*:@:-"1 NB. euclidean distance

0 0 ed 3 4

5

1 2 ed 4 6

5

ed/~ 1 2,:4 6

0 5

5 0

edist 1 2,:4 6

0 25

25 0

edm=:ed/~ NB. euclidean dist matrix verb

>./|,D-*: edm data

8.52651e_14

The same up to roundoff

On Sat, Feb 13, 2021 at 4:54 AM Emir U <[email protected]> wrote:

> Hi guys, I'm very new to J (about 6-7 hours experience), I'm coding a
> bunch of useful algos for clustering, optimisation and stats to give J a
> proper go: this is my first. I (think) I've coded the k-mediods PAM algo as
> described here: https://en.wikipedia.org/wiki/K-medoids
>
> I'm trying to tune my intuition as to what this code should look like when
> written properly. i.e. in canonical form. I'd be grateful for your
> feedback. I've enclosed the code below which is basically the kM_step and
> kM functions: the rest is testing code. If you run it it'll generate some
> data, cluster it and plot it for you.
>
>
> NB. UPDATE MEDIODS FROM DATA.
> kM_step=: 4 : 0
> d=. (x { "1 y)
> s=. ([@> (i. <./) each (;/ d )) { x
> idx=: I. & (= & s)
> d=. { "1 ({ & y)
> w=. (i. <./) & (+/%#) & d
> ; ((w { [) & idx) each x
> )
>
> NB. ITERATE UPDATE STEP TO CONVERGENCE.
> choose=: 4 : '({~ x ? #) ,y'
> kM=: 4 : '(kM_step & y) ^:_ x choose (i. #y)'
>
> NB. CALCULATE PAIRWISE EUCLIDEAN DISTANCE MATRIX.
> edist=: 3 : 0
> x=. +/ |: y^2
> a=. (,.x) +/ .+ (,:x)
> b=. y +/ .* (|: y)
> a - (2*b)
> )
>
> NB. TESTING: GENERATE DATA, FIT & PLOT.
> load 'plot'
>
> data=: ?(50 2$0)
> data=: data,3+(3*?(50 2$0))
> data=: data,5+(4*?(50 2$0))
> D=: edist data
> M=: (3 kM D) { data
>
> pd 'reset'
> pd 'type dot'
> pd 'pensize 3.1'
> pd 'color gray'
> pd ;/ |: data
> pd 'show'
> pd 'color red'
> pd 'pensize 4'
> pd ;/ |: M
>
> M
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


------------------------------

Message: 2
Date: Sat, 13 Feb 2021 13:31:36 +0000
From: "'Michael Day' via Programming" <[email protected]>
To: [email protected]
Subject: Re: [Jprogramming] k-mediods PAM algo, help with canonical
        form
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed

I was having a look at the wiki description with a view to trying to do
my own version
and then comparing with Emir U's code.  But I was stuck wondering about
the lack of definition
of cost,  as well as what the greedy choice of k points is aiming to
optimise at the start. The
algorithm is rather sparsely described there.

Anyway,  I thought it _might_ be worth considering using complex
coordinates,
eg
    cdata =: j./"1 data

Euclidean distance is then eg
    | x1j1 - x0j0

Forgetting that magnitude was simply | ,  I discovered there's a mistake
in the NuVoc:
this appears near the bottom of
https://code.jsoftware.com/wiki/Vocabulary/jdot#dyadic  :

Related primitives
Real/Imag (+. y), Signum (Unit Circle) (* y), Length/Angle (*. y),
Magnitude (* y), .....

Clearly,  it should read " .... Magnitude  (| y), ..."

Faut de mieux,  I came up with this for build,  not knowing what
greediness was trying
to achieve:
    build =: (3 $: ]) : (]{~ (?#))    NB. choose x of y at random,  x =
3 by default...

Cheers,

Mike

On 13/02/2021 13:04, Clifford Reiter wrote:
> I will take a stab at the euclidean distance matrix verb. I note that your
> edist gives the square of the distance.
>
> +/&.:*: 3 4 NB. euclidean length
>
> 5
>
> ed=:+/&.:*:@:-"1 NB. euclidean distance
>
> 0 0 ed 3 4
>
> 5
>
> 1 2 ed 4 6
>
> 5
>
> ed/~ 1 2,:4 6
>
> 0 5
>
> 5 0
>
> edist 1 2,:4 6
>
> 0 25
>
> 25 0
>
> edm=:ed/~ NB. euclidean dist matrix verb
>
>> ./|,D-*: edm data
> 8.52651e_14
>
> The same up to roundoff
>
> On Sat, Feb 13, 2021 at 4:54 AM Emir U <[email protected]> wrote:
>
>> Hi guys, I'm very new to J (about 6-7 hours experience), I'm coding a
>> bunch of useful algos for clustering, optimisation and stats to give J a
>> proper go: this is my first. I (think) I've coded the k-mediods PAM algo as
>> described here: https://en.wikipedia.org/wiki/K-medoids
>>
>> I'm trying to tune my intuition as to what this code should look like when
>> written properly. i.e. in canonical form. I'd be grateful for your
>> feedback. I've enclosed the code below which is basically the kM_step and
>> kM functions: the rest is testing code. If you run it it'll generate some
>> data, cluster it and plot it for you.
>>
>>
>> NB. UPDATE MEDIODS FROM DATA.
>> kM_step=: 4 : 0
>> d=. (x { "1 y)
>> s=. ([@> (i. <./) each (;/ d )) { x
>> idx=: I. & (= & s)
>> d=. { "1 ({ & y)
>> w=. (i. <./) & (+/%#) & d
>> ; ((w { [) & idx) each x
>> )
>>
>> NB. ITERATE UPDATE STEP TO CONVERGENCE.
>> choose=: 4 : '({~ x ? #) ,y'
>> kM=: 4 : '(kM_step & y) ^:_ x choose (i. #y)'
>>
>> NB. CALCULATE PAIRWISE EUCLIDEAN DISTANCE MATRIX.
>> edist=: 3 : 0
>> x=. +/ |: y^2
>> a=. (,.x) +/ .+ (,:x)
>> b=. y +/ .* (|: y)
>> a - (2*b)
>> )
>>
>> NB. TESTING: GENERATE DATA, FIT & PLOT.
>> load 'plot'
>>
>> data=: ?(50 2$0)
>> data=: data,3+(3*?(50 2$0))
>> data=: data,5+(4*?(50 2$0))
>> D=: edist data
>> M=: (3 kM D) { data
>>
>> pd 'reset'
>> pd 'type dot'
>> pd 'pensize 3.1'
>> pd 'color gray'
>> pd ;/ |: data
>> pd 'show'
>> pd 'color red'
>> pd 'pensize 4'
>> pd ;/ |: M
>>
>> M
>>
>> ----------------------------------------------------------------------
>> 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 Avast antivirus software.
https://www.avast.com/antivirus



------------------------------

Message: 3
Date: Sat, 13 Feb 2021 14:47:17 +0100
From: "xash" <[email protected]>
To: <[email protected]>
Subject: Re: [Jprogramming] k-mediods PAM algo, help with canonical
        form
Message-ID: <C98G6ZL5N8MO.30MDDL0D25KOH@xolotl>
Content-Type: text/plain; charset=UTF-8

This is already very good code! Some improvements other than edist:

Using `each` for rank "0 like in the last line of kM_step should be
avoided, as it just boxes/unboxes the result unecessarily.

Instead of building up the groups per hand (I. & (= & s)), you can just
use `/.` to group the indices.

`?` already works on indices, so you can just use `4 ? #` instead of
`({~ 4 ? #) i. # x`.

I'm not sure how the original algorithm should work, but isn't the avarage
(+/%#) unneccesary as the length of the group is equal among its elements?
So +/ should be enough for comparison.

Tacifying your code then a bit results in:

kM2_step=: 4 : 0
groups=. (i. <./)@:{"1
sub=. {"1 {&x
best=. [ {~ [:(i. <./) [:+/"1 sub
(y groups x) best/. (i. # x)
)

kM2=: edist@] kM2_step^:_ (? #)

4 kM2 data

On Sat Feb 13, 2021 at 10:54 AM CET, Emir U wrote:
> Hi guys, I'm very new to J (about 6-7 hours experience), I'm coding a
> bunch of useful algos for clustering, optimisation and stats to give J a
> proper go: this is my first. I (think) I've coded the k-mediods PAM algo
> as described here: https://en.wikipedia.org/wiki/K-medoids
>
> I'm trying to tune my intuition as to what this code should look like
> when written properly. i.e. in canonical form. I'd be grateful for your
> feedback. I've enclosed the code below which is basically the kM_step
> and kM functions: the rest is testing code. If you run it it'll generate
> some data, cluster it and plot it for you.
>
>
> NB. UPDATE MEDIODS FROM DATA.
> kM_step=: 4 : 0
> d=. (x { "1 y)
> s=. ([@> (i. <./) each (;/ d )) { x
> idx=: I. & (= & s)
> d=. { "1 ({ & y)
> w=. (i. <./) & (+/%#) & d
> ; ((w { [) & idx) each x
> )
>
> NB. ITERATE UPDATE STEP TO CONVERGENCE.
> choose=: 4 : '({~ x ? #) ,y'
> kM=: 4 : '(kM_step & y) ^:_ x choose (i. #y)'
>
> NB. CALCULATE PAIRWISE EUCLIDEAN DISTANCE MATRIX.
> edist=: 3 : 0
> x=. +/ |: y^2
> a=. (,.x) +/ .+ (,:x)
> b=. y +/ .* (|: y)
> a - (2*b)
> )
>
> NB. TESTING: GENERATE DATA, FIT & PLOT.
> load 'plot'
>
> data=: ?(50 2$0)
> data=: data,3+(3*?(50 2$0))
> data=: data,5+(4*?(50 2$0))
> D=: edist data
> M=: (3 kM D) { data
>
> pd 'reset'
> pd 'type dot'
> pd 'pensize 3.1'
> pd 'color gray'
> pd ;/ |: data
> pd 'show'
> pd 'color red'
> pd 'pensize 4'
> pd ;/ |: M
>
> M
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



------------------------------

Message: 4
Date: Sat, 13 Feb 2021 16:03:52 +0100
From: "xash" <[email protected]>
To: <[email protected]>
Subject: Re: [Jprogramming] k-mediods PAM algo, help with canonical
        form
Message-ID: <C98HTMI0PQ4G.HRHD3KTEWVLE@xolotl>
Content-Type: text/plain; charset=UTF-8

After reading a bit about it: this seems to implement the Voronoi
Iteration method mentioned in the wikipedia article, not PAM. PAM tries
every possible swap, while the Voronoi Iteration tries only the swaps
within a group. The cost function is the summend distances between
non-mediods and their closest mediods.

On Sat Feb 13, 2021 at 2:47 PM CET, xash wrote:
> This is already very good code! Some improvements other than edist:
>
> Using `each` for rank "0 like in the last line of kM_step should be
> avoided, as it just boxes/unboxes the result unecessarily.
>
> Instead of building up the groups per hand (I. & (= & s)), you can just
> use `/.` to group the indices.
>
> `?` already works on indices, so you can just use `4 ? #` instead of
> `({~ 4 ? #) i. # x`.
>
> I'm not sure how the original algorithm should work, but isn't the
> avarage
> (+/%#) unneccesary as the length of the group is equal among its
> elements?
> So +/ should be enough for comparison.
>
> Tacifying your code then a bit results in:
>
> kM2_step=: 4 : 0
> groups=. (i. <./)@:{"1
> sub=. {"1 {&x
> best=. [ {~ [:(i. <./) [:+/"1 sub
> (y groups x) best/. (i. # x)
> )
>
> kM2=: edist@] kM2_step^:_ (? #)
>
> 4 kM2 data
>
> On Sat Feb 13, 2021 at 10:54 AM CET, Emir U wrote:
> > Hi guys, I'm very new to J (about 6-7 hours experience), I'm coding a
> > bunch of useful algos for clustering, optimisation and stats to give J a
> > proper go: this is my first. I (think) I've coded the k-mediods PAM algo
> > as described here: https://en.wikipedia.org/wiki/K-medoids
> >
> > I'm trying to tune my intuition as to what this code should look like
> > when written properly. i.e. in canonical form. I'd be grateful for your
> > feedback. I've enclosed the code below which is basically the kM_step
> > and kM functions: the rest is testing code. If you run it it'll generate
> > some data, cluster it and plot it for you.
> >
> >
> > NB. UPDATE MEDIODS FROM DATA.
> > kM_step=: 4 : 0
> > d=. (x { "1 y)
> > s=. ([@> (i. <./) each (;/ d )) { x
> > idx=: I. & (= & s)
> > d=. { "1 ({ & y)
> > w=. (i. <./) & (+/%#) & d
> > ; ((w { [) & idx) each x
> > )
> >
> > NB. ITERATE UPDATE STEP TO CONVERGENCE.
> > choose=: 4 : '({~ x ? #) ,y'
> > kM=: 4 : '(kM_step & y) ^:_ x choose (i. #y)'
> >
> > NB. CALCULATE PAIRWISE EUCLIDEAN DISTANCE MATRIX.
> > edist=: 3 : 0
> > x=. +/ |: y^2
> > a=. (,.x) +/ .+ (,:x)
> > b=. y +/ .* (|: y)
> > a - (2*b)
> > )
> >
> > NB. TESTING: GENERATE DATA, FIT & PLOT.
> > load 'plot'
> >
> > data=: ?(50 2$0)
> > data=: data,3+(3*?(50 2$0))
> > data=: data,5+(4*?(50 2$0))
> > D=: edist data
> > M=: (3 kM D) { data
> >
> > pd 'reset'
> > pd 'type dot'
> > pd 'pensize 3.1'
> > pd 'color gray'
> > pd ;/ |: data
> > pd 'show'
> > pd 'color red'
> > pd 'pensize 4'
> > pd ;/ |: M
> >
> > M
> >
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



------------------------------

Message: 5
Date: Sun, 14 Feb 2021 12:20:14 +1300
From: Ric Sherlock <[email protected]>
To: Programming JForum <[email protected]>
Subject: Re: [Jprogramming] Error in comment in
        addons/math/misc/pollard.ijs
Message-ID:
        <caoouvu_1-am8-3fgd_eiqk5e7ynqyfsesvhb_i3r_xjsipe...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Hi Mike,
I've made the suggested change and pushed to GitHub.
Next time the addon is released, the change will be included.

I wonder if it makes sense for suggestions like this to be provided as a
GitHub pull request where possible?
* less chance of miscommunication between report and fix
* easier for maintainers
* links discussion to change

For simple changes like this, that can be done entirely from the GitHub
website.

 * Navigate to:
https://github.com/jsoftware/math_misc/blob/master/pollard.ijs
 * Click the pencil icon on the right ("Edit this file")
 * Make the desired changes
 * Scroll to bottom of page and fill out Commit changes fields
 * Choose option to "Create a *new branch* for this commit and start a pull
request"
 * Click the "Propose changes" button
 * Add commentary/justification to "Open a pull request form"
 * Click the "Create pull request" button


On Fri, Feb 12, 2021 at 5:30 AM 'Michael Day' via Programming <
[email protected]> wrote:

> Further to my delve in the scripts in ~addons/math/misc,  I've just
> noticed a
> misleading comment in pollard.ijs .
>
> The script offers implementations of two Pollard factorisation algorhithms.
>
> The relevant comments are (with a bit of context):
> NB. examples:
> NB.
> NB.    ]x=. (,*/) x: p: 1e7 30101
> NB. 179424691 351599 63085541930909
> NB.    pollardpm1 {: x
> NB. 351599 335
>
> Well - when you actually run it,  this is the result:
>
>        ]x=. (,*/) x: p: 1e7 30101
> 179424691 351599 63085541930909
>        pollardpm1 {: x
> 179424691 2556
>
> Initially,  I thought this might be a bug,   but no.  The result in the
> comment arises from the other function which does pollard rho
> factorisation:
>     pollardrho {: x
> 351599 335
>
> Indeed,  we see that x is defined as the product of the factors found by
> the two methods.
>
> No doubt this little slip has been around for some years.
>
> I suggest the comments be amended to read:
>
> NB. examples:
> NB.
> NB.    ]x=. (,*/) x: p: 1e7 30101
> NB. 179424691 351599 63085541930909
> NB.    pollardpm1 {: x
> NB. 179424691 2556
>     et seq... (no changes needed)
>
> Cheers,
>
> Mike
>
> --
> 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
>


------------------------------

Message: 6
Date: Sat, 13 Feb 2021 23:49:27 +0000
From: "'Mike Day' via Programming" <[email protected]>
To: [email protected]
Subject: Re: [Jprogramming] Error in comment in
        addons/math/misc/pollard.ijs
Message-ID: <[email protected]>
Content-Type: text/plain;       charset=utf-8

Thanks, Ric.

I think I’d prefer to continue offering public comments open to criticism and 
correction in this and perhaps other forums/fora.

 Cheers,

Mike

Sent from my iPad

> On 13 Feb 2021, at 23:20, Ric Sherlock <[email protected]> wrote:
>
> Hi Mike,
> I've made the suggested change and pushed to GitHub.
> Next time the addon is released, the change will be included.
>
> I wonder if it makes sense for suggestions like this to be provided as a
> GitHub pull request where possible?
> * less chance of miscommunication between report and fix
> * easier for maintainers
> * links discussion to change
>
> For simple changes like this, that can be done entirely from the GitHub
> website.
>
> * Navigate to:
> https://github.com/jsoftware/math_misc/blob/master/pollard.ijs
> * Click the pencil icon on the right ("Edit this file")
> * Make the desired changes
> * Scroll to bottom of page and fill out Commit changes fields
> * Choose option to "Create a *new branch* for this commit and start a pull
> request"
> * Click the "Propose changes" button
> * Add commentary/justification to "Open a pull request form"
> * Click the "Create pull request" button
>
>
> On Fri, Feb 12, 2021 at 5:30 AM 'Michael Day' via Programming <
> [email protected]> wrote:
>
>> Further to my delve in the scripts in ~addons/math/misc,  I've just
>> noticed a
>> misleading comment in pollard.ijs .
>>
>> The script offers implementations of two Pollard factorisation algorhithms.
>>
>> The relevant comments are (with a bit of context):
>> NB. examples:
>> NB.
>> NB.    ]x=. (,*/) x: p: 1e7 30101
>> NB. 179424691 351599 63085541930909
>> NB.    pollardpm1 {: x
>> NB. 351599 335
>>
>> Well - when you actually run it,  this is the result:
>>
>>       ]x=. (,*/) x: p: 1e7 30101
>> 179424691 351599 63085541930909
>>       pollardpm1 {: x
>> 179424691 2556
>>
>> Initially,  I thought this might be a bug,   but no.  The result in the
>> comment arises from the other function which does pollard rho
>> factorisation:
>>    pollardrho {: x
>> 351599 335
>>
>> Indeed,  we see that x is defined as the product of the factors found by
>> the two methods.
>>
>> No doubt this little slip has been around for some years.
>>
>> I suggest the comments be amended to read:
>>
>> NB. examples:
>> NB.
>> NB.    ]x=. (,*/) x: p: 1e7 30101
>> NB. 179424691 351599 63085541930909
>> NB.    pollardpm1 {: x
>> NB. 179424691 2556
>>    et seq... (no changes needed)
>>
>> Cheers,
>>
>> Mike
>>
>> --
>> 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
>>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm


------------------------------

Message: 7
Date: Sat, 13 Feb 2021 19:05:08 -0500
From: Henry Rich <[email protected]>
To: [email protected]
Subject: Re: [Jprogramming] Error in comment in
        addons/math/misc/pollard.ijs
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8; format=flowed

Like Ric said, the pull request makes things easier for the maintainers
and makes your request less likely to be forgotten.  You could feel free
to make the comments in the Forum as well.

Hwenry Rich

On 2/13/2021 6:49 PM, 'Mike Day' via Programming wrote:
> Thanks, Ric.
>
> I think I’d prefer to continue offering public comments open to criticism and 
> correction in this and perhaps other forums/fora.
>
>   Cheers,
>
> Mike
>
> Sent from my iPad
>
>> On 13 Feb 2021, at 23:20, Ric Sherlock <[email protected]> wrote:
>>
>> Hi Mike,
>> I've made the suggested change and pushed to GitHub.
>> Next time the addon is released, the change will be included.
>>
>> I wonder if it makes sense for suggestions like this to be provided as a
>> GitHub pull request where possible?
>> * less chance of miscommunication between report and fix
>> * easier for maintainers
>> * links discussion to change
>>
>> For simple changes like this, that can be done entirely from the GitHub
>> website.
>>
>> * Navigate to:
>> https://github.com/jsoftware/math_misc/blob/master/pollard.ijs
>> * Click the pencil icon on the right ("Edit this file")
>> * Make the desired changes
>> * Scroll to bottom of page and fill out Commit changes fields
>> * Choose option to "Create a *new branch* for this commit and start a pull
>> request"
>> * Click the "Propose changes" button
>> * Add commentary/justification to "Open a pull request form"
>> * Click the "Create pull request" button
>>
>>
>> On Fri, Feb 12, 2021 at 5:30 AM 'Michael Day' via Programming <
>> [email protected]> wrote:
>>
>>> Further to my delve in the scripts in ~addons/math/misc,  I've just
>>> noticed a
>>> misleading comment in pollard.ijs .
>>>
>>> The script offers implementations of two Pollard factorisation algorhithms.
>>>
>>> The relevant comments are (with a bit of context):
>>> NB. examples:
>>> NB.
>>> NB.    ]x=. (,*/) x: p: 1e7 30101
>>> NB. 179424691 351599 63085541930909
>>> NB.    pollardpm1 {: x
>>> NB. 351599 335
>>>
>>> Well - when you actually run it,  this is the result:
>>>
>>>        ]x=. (,*/) x: p: 1e7 30101
>>> 179424691 351599 63085541930909
>>>        pollardpm1 {: x
>>> 179424691 2556
>>>
>>> Initially,  I thought this might be a bug,   but no.  The result in the
>>> comment arises from the other function which does pollard rho
>>> factorisation:
>>>     pollardrho {: x
>>> 351599 335
>>>
>>> Indeed,  we see that x is defined as the product of the factors found by
>>> the two methods.
>>>
>>> No doubt this little slip has been around for some years.
>>>
>>> I suggest the comments be amended to read:
>>>
>>> NB. examples:
>>> NB.
>>> NB.    ]x=. (,*/) x: p: 1e7 30101
>>> NB. 179424691 351599 63085541930909
>>> NB.    pollardpm1 {: x
>>> NB. 179424691 2556
>>>     et seq... (no changes needed)
>>>
>>> Cheers,
>>>
>>> Mike
>>>
>>> --
>>> 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
>>>
>> ----------------------------------------------------------------------
>> 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



------------------------------

Message: 8
Date: Sun, 14 Feb 2021 14:06:44 +1300
From: Ric Sherlock <[email protected]>
To: Programming JForum <[email protected]>
Subject: Re: [Jprogramming] Error in comment in
        addons/math/misc/pollard.ijs
Message-ID:
        <caoouvu_zcspucgsbmevtkfponefg_qx+9ogduuafxhbtrj6...@mail.gmail.com>
Content-Type: text/plain; charset="UTF-8"

Yes, you could make your comments suggestions in the forum first if you
prefer.
Then, based on any feedback, submit the pull request.

Ric

On Sun, Feb 14, 2021 at 1:05 PM Henry Rich <[email protected]> wrote:

> Like Ric said, the pull request makes things easier for the maintainers
> and makes your request less likely to be forgotten.  You could feel free
> to make the comments in the Forum as well.
>
> Hwenry Rich
>
> On 2/13/2021 6:49 PM, 'Mike Day' via Programming wrote:
> > Thanks, Ric.
> >
> > I think I’d prefer to continue offering public comments open to
> criticism and correction in this and perhaps other forums/fora.
> >
> >   Cheers,
> >
> > Mike
> >
> > Sent from my iPad
> >
> >> On 13 Feb 2021, at 23:20, Ric Sherlock <[email protected]> wrote:
> >>
> >> Hi Mike,
> >> I've made the suggested change and pushed to GitHub.
> >> Next time the addon is released, the change will be included.
> >>
> >> I wonder if it makes sense for suggestions like this to be provided as a
> >> GitHub pull request where possible?
> >> * less chance of miscommunication between report and fix
> >> * easier for maintainers
> >> * links discussion to change
> >>
> >> For simple changes like this, that can be done entirely from the GitHub
> >> website.
> >>
> >> * Navigate to:
> >> https://github.com/jsoftware/math_misc/blob/master/pollard.ijs
> >> * Click the pencil icon on the right ("Edit this file")
> >> * Make the desired changes
> >> * Scroll to bottom of page and fill out Commit changes fields
> >> * Choose option to "Create a *new branch* for this commit and start a
> pull
> >> request"
> >> * Click the "Propose changes" button
> >> * Add commentary/justification to "Open a pull request form"
> >> * Click the "Create pull request" button
> >>
> >>
> >> On Fri, Feb 12, 2021 at 5:30 AM 'Michael Day' via Programming <
> >> [email protected]> wrote:
> >>
> >>> Further to my delve in the scripts in ~addons/math/misc,  I've just
> >>> noticed a
> >>> misleading comment in pollard.ijs .
> >>>
> >>> The script offers implementations of two Pollard factorisation
> algorhithms.
> >>>
> >>> The relevant comments are (with a bit of context):
> >>> NB. examples:
> >>> NB.
> >>> NB.    ]x=. (,*/) x: p: 1e7 30101
> >>> NB. 179424691 351599 63085541930909
> >>> NB.    pollardpm1 {: x
> >>> NB. 351599 335
> >>>
> >>> Well - when you actually run it,  this is the result:
> >>>
> >>>        ]x=. (,*/) x: p: 1e7 30101
> >>> 179424691 351599 63085541930909
> >>>        pollardpm1 {: x
> >>> 179424691 2556
> >>>
> >>> Initially,  I thought this might be a bug,   but no.  The result in the
> >>> comment arises from the other function which does pollard rho
> >>> factorisation:
> >>>     pollardrho {: x
> >>> 351599 335
> >>>
> >>> Indeed,  we see that x is defined as the product of the factors found
> by
> >>> the two methods.
> >>>
> >>> No doubt this little slip has been around for some years.
> >>>
> >>> I suggest the comments be amended to read:
> >>>
> >>> NB. examples:
> >>> NB.
> >>> NB.    ]x=. (,*/) x: p: 1e7 30101
> >>> NB. 179424691 351599 63085541930909
> >>> NB.    pollardpm1 {: x
> >>> NB. 179424691 2556
> >>>     et seq... (no changes needed)
> >>>
> >>> Cheers,
> >>>
> >>> Mike
> >>>
> >>> --
> >>> 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
> >>>
> >> ----------------------------------------------------------------------
> >> 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
>


------------------------------

Subject: Digest Footer

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


------------------------------

End of Programming Digest, Vol 185, Issue 14
********************************************
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to