J: how do I discard leading axes? 
Author Message
 J: how do I discard leading axes?

I have learned to use the verb (,/) to discard the leading axis from an
array, converting something of shape 2 2 x to shape 4 x, for example.

Now I want to discard all but the last axis from an array, converting
shape 2 2 2 x to shape 8 x, but where the rank of the input is unknown.



Any better ideas?  This seems like a very clumsy way to do something basic.

Henry Rich



Wed, 30 Jul 1997 06:36:10 GMT  
 J: how do I discard leading axes?
Here's one way to discard all but the last axis:

Alternatively:
   ,.&.|:

--
Raul D. Miller





Wed, 30 Jul 1997 07:03:15 GMT  
 J: how do I discard leading axes?
Raul Miller wrote on Friday, February 10:

Quote:
> Here's one way to discard all but the last axis:

> Alternatively:
>    ,.&.|:

A variation on the first expression:  ,&.(<"1"_) .  
The second expression ,.&.|: is rather neat.


Wed, 30 Jul 1997 16:29:49 GMT  
 J: how do I discard leading axes?
      ,.&.|:

Er... on second thought, don't do this.  It does a bit more than just
ravelling...

--
Raul D. Miller





Thu, 31 Jul 1997 08:02:27 GMT  
 J: how do I discard leading axes?

Quote:
Raul Miller writes:
>Here's one way to discard all but the last axis:


Here's another way:


    (;$) a i.1 2 3 4
 +-----------+---+
 | 0  1  2  3|6 4|
 | 4  5  6  7|   |
 | 8  9 10 11|   |
 |12 13 14 15|   |
 |16 17 18 19|   |
 |20 21 22 23|   |
 +-----------+---+



Sat, 02 Aug 1997 03:44:49 GMT  
 J: how do I discard leading axes?
: I have learned to use the verb (,/) to discard the leading axis from an
: array, converting something of shape 2 2 x to shape 4 x, for example.

: Now I want to discard all but the last axis from an array, converting
: shape 2 2 2 x to shape 8 x, but where the rank of the input is unknown.



: Any better ideas?  This seems like a very clumsy way to do something basic.

: Henry Rich

Henry, the first thing that comes to mind is ,.&.|:.
  Cliff

   $i.2 3 4 5
2 3 4 5
   $,/i.2 3 4 5
6 4 5
   $,.&.|:i.2 3 4 5
24 5
   $i.2 3 4 5
2 3 4 5
   $,/i.2 3 4 5
6 4 5
   $,.i.2 3 4 5
2 60
   $,.&.|:i.2 3 4 5
24 5

--
Clifford A. Reiter
Mathematics Department, Lafayette College
Easton, PA 18042 USA,   610-250-5277



Mon, 04 Aug 1997 09:10:30 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. JS-EAI with *JS*-callback

2. Violation error when doing a mov ds,ax

3. js.exception 3279.js

4. help with mov ax,[bx] / mov ax, bx

5. XOR AX,AX ?

6. FSTSW AX vs FNSTSW AX

7. mov ax,[25] = mov ax,25 ?

8. inc ax / add ax,1 - Carry flag?

9. inc ax/ add ax,1 - Carry flag?

10. Inc ax / add ax,1 - Carry flag?

11. mov ax,offset xyz OR lea ax,xyz

12. LED ON while doing a Sequence, then LED OFF - how?

 

 
Powered by phpBB® Forum Software