I just realized that I could gin up an equivalent to
;.3 using gerund { that would not prefetch all the
subarrays.

So, I apologize for the shrillness of some of my
comments.  But I didn't see any way out of what
looked like a disaster.

I still like changing ;.3 for short x.


Henry Rich

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Henry Rich
> Sent: Tuesday, July 29, 2008 10:25 PM
> To: 'Programming forum'
> Subject: RE: [Jprogramming] Memory inefficiency in ;.3 ?
> 
> I found that u\ has u inside the infix loop, which gives
> a MUCH better implementation:
> 
> NB. combine first x axes of y
> combineaxes =: ((*/@{. , }.) $) ($,) ]
> NB. conjunction.  Apply u on squares of size n
> onsquares =: 2 : 0
> yrank =. #$y
> (n&((yrank&combineaxes)@:((n,n)&(u;._3))\)) y
> ) 
> 
> What was killing me was applying onsquares to rank-3
> operands.  Now,
> 
>    a3000_3000_3 =. i. 3000 3000 3
>    7!:2 '0: onsquares 10 a3000_3000_3'
> 208979456
> 
> Bigger (and slower) than I'd like, but at least it doesn't
> fill memory.
> 
> Henry Rich
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] 
> > [mailto:[EMAIL PROTECTED] On Behalf Of Raul Miller
> > Sent: Tuesday, July 29, 2008 8:45 PM
> > To: Programming forum
> > Subject: Re: [Jprogramming] Memory inefficiency in ;.3 ?
> > 
> > On Tue, Jul 29, 2008 at 8:12 PM, Henry Rich 
> > <[EMAIL PROTECTED]> wrote:
> > > It works on moderate-to-small pictures if I reboot my
> > > system so virtual memory is clean.  It is going to fail
> > > no matter what on images bigger than 2kx2k, whereas a
> > > more frugal implementation would succeed.  I will hang on
> > > & hope for improvements in a future release.
> > 
> >    $(+/%#)@,onsquares 3 ?64 64$0
> > 62 62
> >    $(+/%#)@,onsquares 3 ?3000 3000$0
> > 2998 2998
> >    (6!:2,7!:2) '(+/%#)@,onsquares 3 ?3000 3000$0'
> > 3.16313 5.17861e8
> > 
> > -- 
> > Raul
> > 
> ----------------------------------------------------------------------
> > 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