Difference between revisions of "Array"
m (adding doc status category) |
|||
Line 2: | Line 2: | ||
[[Category:Doc Status C]] <!-- For Lumina use, do not change --> | [[Category:Doc Status C]] <!-- For Lumina use, do not change --> | ||
− | = | + | == Array(I1, ''I2,.., In'', A)== |
− | + | Assigns indexes «I1»...«In» to array «A». | |
− | |||
− | = | + | It is bad practice to use [[Array]] to re-index an array. If an array, <code>A</code>, is indexed by <code>I</code>, and you wish to re-index it by another index, <code>J</code>, having the same number of elements (but possibly different values), instead of using <code>Array(J, A)</code>, it is better to use <code>A[@I = @J]</code> (see [[Subscript-Slice Operator]]). The latter will work even if new dimensions are introduced into <code>A</code> later (through array abstraction), while <code>Array(J, A)</code> could very well break since the outer-dimension of <code>A</code> could change unexpectedly. |
− | + | To create a constant vector along index <code>I</code>, use <code>Array(I, x)</code>, where <code>x</code> is atomic (e.g., a scalar). For example, <code>Array(I, 0)</code> is a constant vector along <code>I</code> containing all zeros. | |
− | + | ==See Also== | |
+ | * [[Arrays and Indexes]] | ||
+ | * [[Index]] | ||
+ | * [[Array Functions and Operators]] | ||
+ | * [[More Array Functions]] | ||
+ | * [[Array Abstraction]] | ||
+ | * [[Intelligent Arrays]] | ||
+ | * [[Subscript-Slice Operator]] |
Revision as of 23:08, 19 January 2016
Array(I1, I2,.., In, A)
Assigns indexes «I1»...«In» to array «A».
It is bad practice to use Array to re-index an array. If an array, A
, is indexed by I
, and you wish to re-index it by another index, J
, having the same number of elements (but possibly different values), instead of using Array(J, A)
, it is better to use A[@I = @J]
(see Subscript-Slice Operator). The latter will work even if new dimensions are introduced into A
later (through array abstraction), while Array(J, A)
could very well break since the outer-dimension of A
could change unexpectedly.
To create a constant vector along index I
, use Array(I, x)
, where x
is atomic (e.g., a scalar). For example, Array(I, 0)
is a constant vector along I
containing all zeros.
See Also
Comments
Enable comment auto-refresher