Documentation:Reference:tdi shape - MdsWiki
Personal tools

From MdsWiki

Jump to: navigation, search

TDISHR Shape/size

The shape of an object is the list of its dimension multipliers.
The size of an object is the product of its dimensions.
The length of an object is the number of bytes in an element.

Scalars have the empty shape [] and size 1.
A vector is an array of rank one, i.e., one dimension.
An array x of shape [2,3,4] has leading dimension 2.
The elements of an array are numbered with the first subscript varying
most rapidly, as in Fortran.

Unless bounds are specified, subscripts begin at 0 and go to one less than the dimension multiplier. Fortran begins at 1 by default, CC at 0.

Dimension number begins at 0; Fortran begins at 1; CC allows only 1 dimension, at a time.

SET_RANGE and RESHAPE can be used to change the shape of any array.
SET_RANGE can be used to specify nonzero lower bounds for an array.

In combining different shapes, the rules are:
(1) a scalar combines with anything,
(2) the smaller sized array is used, (This is not F90 conformability.)
(3) the signality of the smaller is used if both are signals, else the first signal dominates.
Example. shape [2,3,4] with [3,7] is [3,7] -- likely a mistake.

In combining different data types, the rules are:
(1) a required data type will force conversion,
(2) a complex with anything is complex,
(3) a real with an integer is a real,
(4) a signed integer with an unsigned integer is signed,
(5) text with anything else is converted,
(6) the longest non-text length of the real part is used.
(7) for conversion to text, lengths are matched and the following are used for other types: B/BU 4, W/WU 8, L/LU 12, Q/QU 20, O/OU 36, F 16, D/G 24, H 40, FC 32, DC/GC 48, and HC 80 bytes.

Example. An octaword combined with an F-complex is an H-complex.