don't know if any faster, but

 4 1 3 2 0 { 2 3 0 1 {("2) 2 0 1{"1 i.5 4 3






On Sunday, May 24, 2020, 11:35:01 a.m. EDT, bill lam <bbill....@gmail.com> 
wrote: 





Suppose a I got a cube and selection vectors for each of the 3 axis, The
following is the way that I do the selection, to transpose the axis to the
front and then do selection. But I think this method is inefficient because
it transpose 3 times.  Any idea of better ways?

  ]a=. i.5 4 3
0  1  2
3  4  5
6  7  8
9 10 11

12 13 14
15 16 17
18 19 20
21 22 23

24 25 26
27 28 29
30 31 32
33 34 35

36 37 38
39 40 41
42 43 44
45 46 47

48 49 50
51 52 53
54 55 56
57 58 59

  f=.?.~5 [ g=.?.~4 [ h=. 2 0 1
  f;g;h
+---------+-------+-----+
|4 1 3 2 0|2 3 0 1|2 0 1|
+---------+-------+-----+
  f{0 1|: g{ 0 1|: h{ 0 1|:a
56 54 55
59 57 58
50 48 49
53 51 52

20 18 19
23 21 22
14 12 13
17 15 16

44 42 43
47 45 46
38 36 37
41 39 40

32 30 31
35 33 34
26 24 25
29 27 28

8  6  7
11  9 10
2  0  1
5  3  4
----------------------------------------------------------------------
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