I wrote:
>  it would be simpler, easier, and faster to work with a pure (unboxed)
>  numeric matrix of values, then slap the headers on when you're done.
>

June responded:
>  I wonder how your approach would be different. Could you please show me how
>  you'd like to go about it with a pure matrix of values?

My wording was ambiguous - sorry about that. The fundamental approach would
be the same whether the data are numeric or boxed or anything else.  That
is, the natural and straightforward way to create a value table from a
list of index-value pairs is to first construct a table of placeholders,
and then populate it with valid values using } .

What would be different would the subsequent management and processing of
that array. I know I'm preaching to the choir, but it's still worth saying
that boxes are convenient, but impose a tax on clarity and ease of use as
much as on performance. So unless you need them to abstract differences in
data type or shape, it's better to work with unboxed values directly.

But if you're really only using J as a middleman to produce an regular
table for plotting in Excel or Google, I can't suggest any improvements to
your approach. Except to ask whether you could produce your plots directly
in J?

June wrote:
>  The reason I use _ as a placeholder for missing data is there could be 0 as
>  an authentic value.

Note that _ is a floating-point value, and on 32-bit architectures,
introducing it into an array of (otherwise homogeneous) integers will
double the space required to represent and process that array. On 64-bit
architectures, ints and floats take the same amount of space, but there
will still be some additional overhead in arithmetic on floats as opposed
to machine integers (e.g. for comparison tolerance). 

I don't think any of that is relevant for your current use-case (for small
arrays, the space overhead of floats vs ints will be negligible, and
anyway will be overwhelmed by the overhead required to represent numbers
as boxes, and the time overhead is zero since you're doing all your
processing outside of J), but I thought it was worth pointing out as a
cavaet for other applications. Alternatives include negative and/or
implausibly large integers.

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

Reply via email to