u;.3 y u;._3 y Max Cubes Adverb
(u;.3)y is the same as x(u;.3)y (see below)
where x is given by (#$y) $ <./ $y
This means that y is effectively chopped into squares | cubes | hypercubes of side (<./ $y) (viz. the shortest axis of y) which are displaced by 1 position along each axis.
Likewise (u;._3)y .
1. There are no common uses for (u;.3 y) or (u;._3 y) . The verb computed by (u;.3) is invariably used with an actual x-argument. Likewise (u;._3).
Use These Combinations
(See below, where the corresponding section includes the monadic case.)
x u;.3 y x u;._3 y Subarrays Adverb
x(u;._3)y applies verb u to each tile of a regular tiling of y specified by x.
DEFINITION: a tiling of y is a partitioning into smaller arrays, each having the same rank as y.
A regular tiling is one in which all the (completed) tiles have the same shape.
Uncompleted tiles are discarded, i.e. tiles which spill over the boundary of the array.
(u;.3) is like (u;._3), except that the results from uncompleted tiles are not discarded.
Argument x defines the tiling of y. It needs to specify where each tile starts and finishes.
NOTE: tiles can overlap. But we can assume:
- all tiles are the same shape
- if tiles overlap, they do so regularly
- the first tile always begins at coordinates (0 0) for a matrix, (0 0 0) for a brick, and so on.
Therefore, as well as the tile shape, all that's needed is to specify the starting-point coordinates of the second tile along the main diagonal of y. This (set of coordinates) is called the movement vector, i.e. the displacement needed in each dimension to begin the next tile.
Typically, x has 2 rows:
- Row 0: the movement vector (explained above)
- Row 1: the shape of a tile (which is the same for all completed tiles)
If x is a list, then it behaves the same as (1,:x)
]a =. 5 6 $ 'abcdefghijklmnopqrstuvwxyz0123' abcdef ghijkl mnopqr stuvwx yz0123 MovementVector=: 2 2 TileSize=: 2 4 ] x=: MovementVector ,: TileSize 2 2 2 4
Argument x, as given above, specifies the following manner of tiling the table a
(the movement vector (2 2) specifying the horizontal and vertical displacement necessary to move to the next tile)
Let's use this value of x to Box (<) each tile
u=: < NB. Box tiling_3=: ;._3 NB. discards uncompleted tiles tiling3=: ;.3 NB. includes uncompleted tiles x <tiling_3 a +----+----+ |abcd|cdef| |ghij|ijkl| +----+----+ |mnop|opqr| |stuv|uvwx| +----+----+ x <tiling3 a +----+----+--+ |abcd|cdef|ef| |ghij|ijkl|kl| +----+----+--+ |mnop|opqr|qr| |stuv|uvwx|wx| +----+----+--+ |yz01|0123|23| +----+----+--+
1. In image-processing applications, x u;._3 y can be used for filtering and convolution:
]image =. 255 * 5 5 $ 0 0 1 1 1 0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 ]vsobel =. 3 3 $ _1 0 1 _2 0 2 _1 0 1 _1 0 1 _2 0 2 _1 0 1 (1 1,:3 3) (+/@:,@:*)&vsobel;._3 image NB. Convolution with the Sobel operator 1020 1020 0 1020 1020 0 1020 1020 0
Important: x u;._3 y is slow when y has rank greater than 2. Arrange your image data so that convolutions are performed on 2-cells. In other words, store your image as three tables, each of one color component, rather than as a table of triples.
Infix (\) — as in: (x u\ y).
1. A subarray of y has the same rank as y.
2. u may not be a cyclic gerund.
3. A negative value in the second row of x causes that axis to be reversed before u is applied. (The absolute value is used for the length of the axis.)
4. A value in the second row of x larger in magnitude than the length of the axis causes that axis to be taken in full. Values of _ and __ may be used.
6. When the spacing vector is 1, u is applied at each possible starting position.
7. If there is only one axis of motion, x u;._3 y is the same operation as x u\ y. Exception: if the length is 0, 0 u\ y has one more (empty) item in the result than 0 u;._3 y.
8. If an atom in the spacing vector is 0, only position 0 is used for that axis.
1. Even if only one starting position in an axis is possible (because the spacing vector is 0 or the shape is _ for the axis), the axis still appears in the shape of the result. This is different from the treatment of omitted axes in x u;.1 y.
2. If y is a table, it is possible that execution will be restarted, possibly more than once, after a few intervals have been processed. This will result in reexecution of some intervals at the top-left of the table. The reexecutions will not appear in the result, but if there are side effects from execution on an interval, the side effects will be repeated.
Use These Combinations
Combinations using x ;.3 y that have exceptionally good performance include:
What it does Type;
Operations on subarrays list or table u;.3 y
x u;.3 y
;._3 in place of ;.3 avoids building cell indexes. Apply ;.3 _3 at rank 2 or lower