The Index



next up previous contents index
Next: Differentiation Up: Indexed Objects Previous: mkobj() Examples

The Index

  Except for access granted by specialized functions, the index is the only way to manipulate the components of an indexed object. The index is also used to indicate operations to be performed on the object as a whole during the evaluation of an algebraic expression (see below, and Chapter 3).

As has been mentioned, the index itself consists of a set of integers and/or identifiers, separated by commas and enclosed in square brackets. There are two distinctly different kinds of index possible:

  1. all indices are integers, the index then refers to a specific component of the object, which can be immediately read-out or assigned,
  2. at least one index element is not an integer, and the index therefore is a pattern representing a set of components.
In the first case the index is called a ``fixed'' index, and in the second case it is called a ``pattern'' index.

The identifiers used in a pattern index are (aside from the indices used to indicate contractions) completely arbitrary. As such, they are not evaluated, so that any values they might have do not interfere with their use as indices. For example, the algebraic value of a does not affect its use in the index of g:

 
#: a := 324$

#: g[a,b];      % no problem with ``a'' having a value.

   g
    a b
To accommodate the possibility where the user may wish to use a REDUCE for loop to, for example, copy an indexed object to a REDUCE matrix, the switch evalindex is provided. If on, this switch causes all identifiers in an index to be evaluated; of course, if they do not evaluate either to an integer or an identifier, an error will result (in the above example, with evalindex on, an index-out-of-range error would occur).

  There are three operators that can be used in an index which denote operations that are applied to individual indexed objects: differentiation, raising and lowering of indices via metric contractions (``shifting''), and symmetrization of indices. As of REDTEN v4.00 this last operation can also be applied across a product of indexed objects using the function symz().

In general only the symmetrization operation is performed immediately (but this can be suppressed if the switch symzexp is turned off, see below), the other operations are held pending the use of the object in an indexed assignment (the subject of Chapter 3). In special cases, as noted elsewhere, the operations may be evaluated immediately.





next up previous contents index
Next: Differentiation Up: Indexed Objects Previous: mkobj() Examples



John Harper
Wed Nov 16 13:34:23 EST 1994