Dan Bron wrote:
> yours.  However, I was hoping for a solution that would complete in  
> about half the time of the solutions I provided.  That is, I'd like
> a 2x or 100% speedup;  drag  is only about 20% faster than  drag0 
> on my dataset.

Hmm... taking this apart:

   dragR=: {~ [EMAIL PROTECTED] >./\@:* ] [EMAIL PROTECTED] 1{.0{.]

We have several full scans of the data set:
  e.
  -.
  i.
  *
  >./\
  {

That's a total of six operations.

Ideally, we'd like to eliminate at least two more of those, maybe
three.  And, frankly, I can't think of any approach that folds
several of these together or takes advantage of special code.

That said, perhaps replacing { with } would be useful.

In other words, something like:
   b=. (e. 1{.0{.]) DATA
   r=. DATA {~ b # >./\(-.b)*i.#b
   r (I.b)} DATA

This adds a few operations, but if DATA has fat rows
and relatively few blank rows, this should perform better.

-- 
Raul

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

Reply via email to