I was not able to reproduce your (relative) results:
5 ts ';<@({.,.}.)\.i. 1000'
0.02549272 9644672
5 ts ' ;(i. ([ }.@,. }.)&.> <@i.) 1000'
0.026176347 9636864
rnk 5 ts&> ';<@({.,.}.)\.i. 1000'; ' ;(i. ([ }.@,. }.)&.> <@i.) 1000'
0 1 1
1 1 1
which means the relative difference in time and in space is less than 5
percent.
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [EMAIL PROTECTED] [mailto:programming-
> [EMAIL PROTECTED] Namens Brian Schott
> Verzonden: donderdag 17 januari 2008 16:14
> Aan: Programming forum
> Onderwerp: RE: [Jprogramming] Pythagorean triples
>
> I was about to post a suggestion having to do with a
> different way to produce all pairs in this situation when
> your message came in. So instead I elected to compare your
> version of all pairs with one suggested by Roger Hui at
> http://www.jsoftware.com/pipermail/programming/2007-February/005123.html
>
> ts =: (6!:2,7!:2)@]
> ts ';<@({.,.}.)\.i. 1000'
> 0.187662 9.64467e6
> ts ' ;(i. ([ }.@,. }.)&.> <@i.) 1000'
> 0.120952 9.63686e6
> (;<@({.,.}.)\.i. 10)-:;(i. ([ }.@,. }.)&.> <@i.) 10
> 1
>
>
> On Thu, 17 Jan 2008, R.E. Boss wrote:
>
> + Different approach (haven't looked at the lab yet):
> +
> + P2=: 3 : '%:(+/(,~#"1~(e.{:)) ])&.|:;<@({.,.}.)\.*:}.>:i.y'
> +
>
> (B=)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm