> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Roger Hui
> Sent: Tuesday, July 29, 2008 1:21 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Excess axes in 3 3&(0:;._3) i. 4 4 2
> 
> In the general case of x f;.3 y the left argument x
> is a 2-row table of (movement,:size) with as many 
> columns as the rank of y .  A list x is treated as
> as if the movements were 1 and the sizes were x,
> and an x with an insufficient number of columns
> is treated as if the missing movements were 1
> and the sizes were the sizes of the corresponding
> axes of y .

I can see that that's what the implementation does; I'm suggesting
that the treatment of x with insufficient columns could be improved.

It would be pleasant if x f;.3 y returned a result rank of
(#$x) + rank of result of f .

> 
> >   I have asked for an operation to be applied to 3x3 subarrays
> > of the operand; each result returns a scalar, so the result
> > should be rank 2, shape 2 2.
> 
> Even in your interpretation the verb is applied to 3 3 2 subarrays,
> not 3 3 subarrays.

Well, this is really the point.  Yes, in this case they are 3x3x2.  But
I want to think of them as 3x3 arrays of whatever size the _2-cells of
y are.  Here, the _2-cells are lists of length 2, so the operation is
on 3x3x2 arrays.  But if I code a verb that returns a scalar on
a _2-cell, I would like the result to be shape 3 3 , (shape of y result),
in other words 3 3.

> 
> Also, consider:
> 
>    $ 3 2 <;._3 i.3 7
> 1 6
>    $ 3 2 5 4 <;._3 i.3 7 5 13
> 1 6 1 10
> 
> Shouldn't the "surplus" unit axes be discarded?

Of course not - I asked you to operate on subcells of that
size, and you happened to find 1.  In the case I'm talking
about, I didn't give you a size, for the very reason that
I don't want you to be looking for subarrays on those axes.
THAT's why the axes shouldn't be in the result - I didn't ask
you to do the subarrays thing on them.


I'll just apply ,"_2 to the result, I suppose.

Henry Rich

> 
> 
> 
> ----- Original Message -----
> From: Henry Rich <[EMAIL PROTECTED]>
> Date: Tuesday, July 29, 2008 9:42
> Subject: [Jprogramming] Excess axes in 3 3&(0:;._3) i. 4 4 2
> To: 'Programming forum' <[email protected]>
> 
> >   $ 3 3&(0:;._3) i. 4 4 2
> > 2 2 1
> > 
> >   The shape should be 2 2, methinks.
> > 
> >   I have asked for an operation to be applied to 3x3 subarrays
> > of the operand; each result returns a scalar, so the result
> > should be rank 2, shape 2 2.
> > 
> >   The interpreter has treated it as if I had written
> > 3 3 2&(0:;._3) which would be applying the verb to 3x3x2
> > subarrays.
> > 
> >   But if I had wanted that, I should have written it.  By
> > omitting the trailing axes I should be indicating that I want
> > to take them in full, and their structure (which might include
> > several axes) should disappear from the result.
> > 
> >   The Dictionary does not speak to this point, but I think
> > my suggestion here is better than the current design.  As it
> > is I have to know how many axes should be left and discard the
> > surplus.
> ----------------------------------------------------------------------
> 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