next up previous contents
Next: Homework Up: Arrays Previous: Masked Assignment   Contents

Vector-valued Subscripts

Are useful for building irregular sections of arrays (when subscripts do not follow a linear pattern).

For example,

integer, dimension(2) :: V=(/4,2/)
integer, dimension(4) :: W=(/3,2,4,1/)
real, dimension(10,10) :: A

A(V,W) is the irregular section of the matrix resulting from intersecting rows with columns .

If , , , then ; is OK and will produce , but should be avoided since the subscript 3 is repeated ( is assigned twice, and since no order can be guaranteed in the parallel assignment, the result is not well defined).

Vector subscripting basically performs index indirection (of one, two or more nested levels) and is therefore very inefficient; it should not be used unless really necessary.



Adrian Sandu 2001-08-26