Re: [Jprogramming] speed difference in an arithmetic verb

2015-02-15 Thread Raul Miller
Or, more concisely, A =: >:@[ %@:+ + -:@:* >:@:+ is considerably faster than A =: >:@[ %@+ + -:@* >:@+ in this context. Thanks, -- Raul On Sun, Feb 15, 2015 at 5:46 PM, Tikkanz wrote: > I suspect that a significant reason for the speed increase is that the verb > ranks of * and + are 0. >

Re: [Jprogramming] speed difference in an arithmetic verb

2015-02-15 Thread Tikkanz
I suspect that a significant reason for the speed increase is that the verb ranks of * and + are 0. * b. 0 + b. 0 This means that %@+ for example will calculate % for each item of the right argument, whereas if you use %@:+ then % will wait until all the items have been processed and then calculat

[Jprogramming] speed difference in an arithmetic verb

2015-02-15 Thread Robert Clausecker
Hello! To see how J compares to other languages out there, I tried to implement the spectral-norm [1] language benchmark in J. Part of my code [2] for this looks like this: NB. entry at x,y of infinite matrix A A =: >:@:[ %@:+ -:@:(* >:)@:+ NB. get the first y by y elements of A