Thanks for the advice.

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Dan Bron
Sent: December 3, 2009 11:41 AM
To: Programming forum
Subject: Re: [Jprogramming] averages of non-zero elements of matrices

Robert O'Boyle wrote:
>   The sparse array approach offers considerable potential 

That was a lark -- I do not suggest you pursue it.  

For one thing, even if you use sparse arrays, you won't reduce the number
of "rectangular guards" very much.  The short story is that you don't have
to worry about the value of missing items, but you still need to worry
about their indices.  That is, the location of missing values is still
there and will respond to inqueries; it is merely the value that is
unspecified, and cannot play a role.  The fact that in the two definitions
of average,  +/  remained the same but  #  turned into  +/@:~:&0 
exemplifies this difference.

For another thing, sparse arrays don't get much use in J.  Therefore they
still have sharp corners.  You will surely encounter phrases that should
work, but don't.  Also maybe the odd crash.  So, if you do pursue this
path, please report these problems as you encounter them (that'll help the
next guy who uses sparse arrays).

-Dan

PS:  

No matter what approach you take (sparse or otherwise), to try to calculate
with "missing values" is working against the grain of J.  You're trying to
force J to perform unnatural acts; expect it to balk.

In the end, you'll have a much easier time if you use boxes, rank, and
maybe cut, along the lines I sketched in my first message.
----------------------------------------------------------------------
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