Re: [Jprogramming] Arg min

2019-12-28 Thread Arnab Chakraborty
In the Arabian Nights, there are many tales involving castles with locked doors. Behind each door is an unexpected world more intriguing than the last. Well, J is like that. I am standing in awe before the latest door labelled Special Codes. On Sat, 28 Dec 2019, 20:06 Ric Sherlock, wrote: > The

Re: [Jprogramming] Arg min

2019-12-28 Thread Ric Sherlock
The best source of info on special code or Combinations that I know of is here: https://code.jsoftware.com/wiki/Vocabulary/SpecialCombinations On Sun, Dec 29, 2019 at 1:59 AM Raul Miller wrote: > On Sat, Dec 28, 2019 at 7:38 AM Arnab Chakraborty > wrote: > >Thanks for the code. But I did n

Re: [Jprogramming] Arg min

2019-12-28 Thread Raul Miller
On Sat, Dec 28, 2019 at 7:38 AM Arnab Chakraborty wrote: >Thanks for the code. But I did not quite comprehend the phrase "special > code". Do you mean that the hook (i. <./) gets replaced by some low level C > code, instead of being parsed as a general hook? I believe it's that (i. <./) gets

Re: [Jprogramming] Arg min

2019-12-28 Thread Arnab Chakraborty
Hi Ric, Thanks for the code. But I did not quite comprehend the phrase "special code". Do you mean that the hook (i. <./) gets replaced by some low level C code, instead of being parsed as a general hook? On Fri, 27 Dec 2019, 08:38 Ric Sherlock, wrote: > You could also use > > argminall=: 4

Re: [Jprogramming] Arg min

2019-12-26 Thread Ric Sherlock
You could also use argminall=: 4 $. $.@(= <./@,) However because neither take advantage of the special code (i. <. /), they don't have the same performance. On Fri, 27 Dec 2019, 14:42 Jimmy Gauvin, wrote: > Adding to Henry's idiom : > >argminall =: $ #: I.@(= <./)@, >argminall 3 3$5 >

Re: [Jprogramming] Arg min

2019-12-26 Thread Jimmy Gauvin
Adding to Henry's idiom : argminall =: $ #: I.@(= <./)@, argminall 3 3$5 0 0 0 1 0 2 1 0 1 1 1 2 2 0 2 1 2 2 On Thu, Dec 26, 2019 at 8:23 PM Arnab Chakraborty wrote: > wow! > > On Thu, 26 Dec 2019, 10:43 Henry Rich, wrote: > > > argmin =: $ #: (i. <./)@, > > > > This is a standard APL

Re: [Jprogramming] Arg min

2019-12-26 Thread Arnab Chakraborty
wow! On Thu, 26 Dec 2019, 10:43 Henry Rich, wrote: > argmin =: $ #: (i. <./)@, > > This is a standard APL idiom. > > Henry RIch > > On 12/26/2019 12:01 AM, Arnab Chakraborty wrote: > > Dear all, > > > > I want to find the position (i,j) of the min entry in a n by n matrix. > > > > My current sol

Re: [Jprogramming] Arg min

2019-12-25 Thread Henry Rich
argmin =: $ #: (i. <./)@, This is a standard APL idiom. Henry RIch On 12/26/2019 12:01 AM, Arnab Chakraborty wrote: Dear all, I want to find the position (i,j) of the min entry in a n by n matrix. My current solution is ((=<./),mat )#"1 2,/(i.n),"0/i.n Is there a smarter method? --

[Jprogramming] Arg min

2019-12-25 Thread Arnab Chakraborty
Dear all, I want to find the position (i,j) of the min entry in a n by n matrix. My current solution is ((=<./),mat )#"1 2,/(i.n),"0/i.n Is there a smarter method? -- For information about J forums see http://www.jsoftware.com/