El

Scan Operator (\)

The symbol for the scan operator is \. The forms of scan are:@\[Il B,@\B or

@+B, where@can be any scalar dyadic primitive function and argument B is a

numeric vector or other array. The scan operator, like the reduction operator,

operates on the elements of a single vector, and is the same as putting the primitive

dyadic function between each of the elements. But the scan operator accumulates

the results as the operation is repeated along the vector. The shape of the result is

the same as that of the input argument:

+\ 1. 2 J I+ 5

+ 1.

+ 1. +* 2

4. 1. .t 24.3

.e 1. +2+3+4

.t.3.+.~.t.3+l.~.t.~~;

1. 3 rs 1.0 3.54 This result is the same

I.

3

6

1. 0

15

as doing the following for

each element in the result.

When argument B is a multidimensional array, the [I] index entry is used to specify

the coordinate the scan is to proceed along. If the index entry is omitted, the last

coordinate (columns) is acted on. If the@ +B form is'used, the first coordinate

is acted on.

Bt-3 4p I 12

B

1. 2 3 I+

5 b '7 8

9 10 11. 12

23b

8 1.0 3.2

1.8 21. 24.

.+\I: 1.JH- The first coordinate (rows) is specified; therefore,

the scan is between rows.

4 The second coordinate (columns) is specified;

therefore, the scan is between columns.

3 3. 1. 3. 8 20

9 19 30 b2

*+a \ B

1. 3 6 10

!3 1 :I. 1.8 26

9 19 30 42

4tB

1234

6 83.03.2

15 1.8 21 24.

118

Scan Operator (\)

The symbol for the scan operator is \. The forms of scan are:@\[Il B,@\B or

@+B, where@can be any scalar dyadic primitive function and argument B is a

numeric vector or other array. The scan operator, like the reduction operator,

operates on the elements of a single vector, and is the same as putting the primitive

dyadic function between each of the elements. But the scan operator accumulates

the results as the operation is repeated along the vector. The shape of the result is

the same as that of the input argument:

+\ 1. 2 J I+ 5

+ 1.

+ 1. +* 2

4. 1. .t 24.3

.e 1. +2+3+4

.t.3.+.~.t.3+l.~.t.~~;

1. 3 rs 1.0 3.54 This result is the same

I.

3

6

1. 0

15

as doing the following for

each element in the result.

When argument B is a multidimensional array, the [I] index entry is used to specify

the coordinate the scan is to proceed along. If the index entry is omitted, the last

coordinate (columns) is acted on. If the@ +B form is'used, the first coordinate

is acted on.

Bt-3 4p I 12

B

1. 2 3 I+

5 b '7 8

9 10 11. 12

23b

8 1.0 3.2

1.8 21. 24.

.+\I: 1.JH- The first coordinate (rows) is specified; therefore,

the scan is between rows.

4 The second coordinate (columns) is specified;

therefore, the scan is between columns.

3 3. 1. 3. 8 20

9 19 30 b2

*+a \ B

1. 3 6 10

!3 1 :I. 1.8 26

9 19 30 42

4tB

1234

6 83.03.2

15 1.8 21 24.

118