Next: Structure Insertion, Previous: Insertion, Up: Insertion [Contents][Index]
Insertion into arrays (Arrays), strings (Strings), file arrays (File Arrays), and associated variables (Associated Variables) goes according to the following format:
var(
subscripts
) = expr
where subscripts
is a comma-separated list of one or more
subscripts (only one subscript is allowed for associated variables).
The subscripts (after expansion of lists and structures, Lists of Subscripts) may be scalars (Scalars), ranges (Ranges), or
numerical arrays (Arrays), and in general there must be as many
subscripts as there are dimensions in var
.
If expr
has only one element, then this element is inserted
at every place indicated by the subscripts
. In that case
the conditions on the dimensions of expr
that are listed
below do not apply.
You specify the part of var
that receives values from
expr
in one of the following ways:
Keyword /OUTER
specifies that the coordinates are combined as in
a generalized outer product: all possible combinations of the various
coordinates are serviced. For example, in x(1:2,[7,4,2]) =
expr
, expr
must have dimensions 2 by 3, and the
elements of expr
(in the order (0,0), (1,0), (0,1),
(1,1), (0,2), (1,2)
) are inserted into x
in the elements
(1,7), (2,7), (1,4), (2,4), (1,2), (2,2)
respectively.
In this case each dimension of expr
must be equal to the
number of elements in the corresponding non-scalar subscript to
x
.
Keyword /INNER
specifies that the coordinates are combined as in
a generalized inner product: each element of each multi-element
subscript is used only once. For example, in
x([1,2],[7,4],/INNER) = expr
, the expr
must
have the same number of elements as each multi-element subscript to
x
, and all multi-element subscripts to x
must have the
same number of elements. The elements of expr
are inserted
in x
in the elements (1,7), (2,4)
, respectively.
By default, /OUTER
is assumed if none of the subscripts has more
than one dimension, and /INNER
otherwise.
In addition, the elements of a single subscript which is a numerical
array
can be interpreted as if its elements were specified as
separate scalar
s, by specifying the /SEPARATE
keyword.
You may specify fewer subscripts than there are dimensions only if you
also specify one of the keywords /ZERO
or /ALL
. Keyword
/ZERO
indicates that all omitted remaining subscripts are to be
taken equal to zero. Keyword /ALL
indicates that all omitted
remaining subscripts are to be taken equal to *
. These keywords
can be combined with keyword /SEPARATE
.
expr
has fewer dimensions than var
, or if keyword /ONEDIM
is specified, then the insertion is done in one-dimensional fashion,
starting at the element of var
that is indicated by the
subscripts. For example, in x(2,4,0) = expr
with
expr
having fewer than three dimensions, the elements of
expr
are inserted into consecutive elements of x
,
starting at the element of x
that corresponds to coordinates
(2,4,0)
.
If expr
has the same number of dimensions as
var
and if keyword /ONEDIM
is not specified, then
the insertion is done taking the dimensional structure of
var
into account. For example, regard x(2,4,0) =
with expr
expr
with 3 dimensions. Assuming
that expr
has at least two elements in each dimension,
elements (0,0,0), (1,0,0)
of expr
are inserted in
elements (2,4,0), (3,4,0)
of x
. Elements (0,1,0),
(1,1,0)
go to (2,5,0), (3,5,0)
, and elements (0,0,1),
(1,0,1)
to (2,4,1), (3,4,1)
.
var
. In this case
var
and expr
are treated as one-dimensional
arrays and the elements of expr
are inserted in
var
starting at the specified index.
In any of the methods of insertion, it is illegal to try to insert data beyond the boundaries of the target.
The intention is to expand this kind of insertion to allow multiple
levels of insertion target specifications (such as
x(5,*)(22).ALPHA = y
), but this is not yet implemented.
See also: Data Classes, Subscripts
Next: Structure Insertion, Previous: Insertion, Up: Insertion [Contents][Index]