I.) 13
c.7 5i
c’ c:
3 3 2- Shape Vector
The following examples show the result when the two matrices in the preceding example
are catenated instead of laminated:
The / Function: Compress
Monadic (One-Argument) Form
See Reduction later in this chapter under APL Operators.
Dyadic (Two-Argument) Form: Compress A/[Il B or A/B or AjB
The compress function selects elements from argument B corresponding in sequence
to 1's in argument A. Argument A must be a logical scalar or vector having the
values 0 or 1. Argument B can be any scalar, vector, or other array. Both arguments
must have the same number of elements unless:
0 One of the arguments is a scalar or single-element array.
0 Argument B is an array; then the number of elements in argument A must be
the same as the length of the argument B coordinate being acted on.
When argument B is an array, the [I1 index entry is used to specify the coordinate
that is acted on. If the index entry is omitted, the last coordinate (columns) is
assumed. If the AM form is used, the first coordinate is assumed. The rank of the
result is the same as the rank of argument 8:
,. ...
1 3 3
:I. 2 3
:I. :I. :I. / :I. L ,:I
II 0 I) / 1. 2 3
Blank Display Line (empty array)
0 1. :I. 0 /' i:: 2 ::I B
2 (<, 3 "i' z
:I. i) :I. 1.
:I. 0 3. /B
:I. 2 3 4.
P 1 I1 :I. :I. :I. 2
2 3
6 '7
:I. 0 1 1.
0 1 :I. O / E
1. / B
:I. 2 3 4.
9 b '7 13
9 1. 0 1. :I. 3. 2
I. 0 :I. 1. I. 2
The first coordinate (rows) is specified;
the first and third rows, as specified by
argument A, are selected.
The second coordinate (columns) is specified;
the second and third columns, as specified by
argument A, are selected.
Blank Display Line (empty array)
Previous Page Next Page