Documentation:Reference:TDI S2 - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

SLOPE_OF (A)

MDS Operation. Get the slope/delta field.

Arguments Optional: N.
A descriptor as below.
N integer scalar, from 0 to number of slope segments less
one.

Result.. A is searched for these:
DSC$K_DTYPE_RANGE, the delta field or 1.
DSC$K_DTYPE_SLOPE, the N-th slope field.
Otherwise, an error.

Examples. SLOPE_OF(2..5) is 1. SLOPE_OF(1..10..0.5) is 0.5.

smooth (ARRAY,[DIM],WIDTH)

Transformation. Rectangular average along a dimension.

Arguments Optional: DIM.
ARRAY numeric.
DIM integer scalar from 0 to n-1, where n is rank of ARRAY.
WIDTH integer scalar.

Signals. Same as ARRAY.
Units... Same as ARRAY.
Form.... Same as ARRAY.

Result.. The average of element along dimension DIM from WIDTH/2
before to WIDTH/2 afterward.

Example. ??

solve (VECTOR,MATRIX)

Miscellaneous. Solve linear equations: MATMUL(MATRIX,X)=VECTOR.

Arguments
VECTOR real or complex vector of n elements.
ARRAY real or complex array of shape [n,n].

Signals. Same as VECTOR.
Units... Same as INVERSE(MATRIX) * VECTOR.
Form.... Vector of compatible type of VECTOR and ARRAY.

Result.. Equivalent to MATMUL(INVERSE(MATRIX),VECTOR).

Example. SOLVE([3,4],SET_RANGE(2,2,[1,2,2,5])) is [7.0,-2.0].

SORT (ARRAY)

Miscellaneous. Make index list of ascending array.

Argument.
ARRAY integer, real, or character.

Signals. Same as ARRAY.
Units... None.
Form.... Array of offsets.

Result.. The ascending order list of offsets, such that
MAP(A,SORT(A))[j] <= MAP(A,SORT(A))[j+1].
>>>>>>>>>WARNING, equal values may not be in their original
order. This is may be true for all n*log2(n) sorts.

Examples. SORT([3,5,4,6]) is [0,2,1,3].
SORT(['abc','ab','b']) is [1,0,2].
_a=[3,5,4,6],MAP(_a,SORT(_a)) is [3,4,5,6].

See also. SORTVAL to get sorted array without the index.

SORTVAL (ARRAY)

Miscellaneous. Rearrange element to make an ascending array.

Argument.
ARRAY integer, real, or character.

Signals. Same as ARRAY.
Units... Same as ARRAY.
Form.... Same as ARRAY.

Result.. The ascending ordered list of values, such that
SORTVAL(ARRAY)[j] <= SORTVAL(ARRAY)[j+1] for all j.
This is the same as MAP(ARRAY,SORT(ARRAY)).

Examples. SORTVAL([3,5,4,6]) is [3,4,5,6].
SORTVAL(['abc','ab','b']) is ['ab ','abc','b '].

See also. SORT to sort index. That index may be use for
several arrays. BSEARCH for a binary search.

SPACING (X)

F90 Numeric Elemental. Absolute spacing of model numbers near argument.

Argument. X must be real. Complex numbers are an error.

Signals. Same as X.
Units... Same as X.
Form.... Same as X.

Result.. b(e-p), where b is the base, e is the exponent part of
X and p is the digits of precision.

Example. SPACING(3.0) is 2-22 on the VAX.

SPAWN ([COMMAND],[INPUT],[OUTPUT])

VMS IO. Do commands or command file.

Arguments. Optional: COMMAND, INPUT, OUTPUT
COMMAND character scalar of command to execute.
INPUT character scalar name of file for SYS$INPUT.
OUTPUT character scalar name of file as SYS$OUTPUT.

Signals. None.
Units... None.
Form.... Status returned.

Result.. None.

>>>>>>>>>WARNING, side effects.

SPREAD (SOURCE,DIM,NCOPIES)

F90 Transformation. Replicates an array by adding a dimension.
Broadcasts several copies of source along a specified dimension.

Arguments
SOURCE any type, rank (n) must be less than 254.
DIM integer scalar from 0 to n.
NCOPIES integer scalar.

Signals. Same as ARRAY except that dimensions DIM and above are
moved up one and dimension DIM is empty.
Units... Same as ARRAY.
Form.... Same type as SOURCE with shape [E[0:DIM-1],
MIN(NCOPIES,0),E[DIM:n]] where E is the shape of SOURCE.

Result.. The value of an element with subscripts [r0,r1,...rn] is
the value of the element of source with subscripts
[s0,...sn-1], where [s0,...sn-1] is [r0,...rn] with
subscript DIM omitted.

Example. SPREAD([2,3,4],0,3) is the array [2 3 4].
[2 3 4]
[2 3 4]

SQRT (X)

F90 Mathematical Elemental. Square root.

Argument. X must be real or complex. HC is convert to GC.

Signals. Same as X.
Units... Half the count of each unit.(Today, bad if X has units.)
Form.... Same as X.

Result. The processor approximation to the square root of X.
A complex result is the principal value with the real
part greater that or equal to zero. When the real part
is 0, the imaginary part is >= 0.

Example. SQRT(4.0) is 2.0, approximately.

SQUARE (X)

Numeric Elemental. Product of number with itself.

Argument. X must be numeric.

Signals. Same as X.
Units... Same as X * X.
Form.... Same as X.

Result.. X * X.

Example. SQUARE(3) is 9.

STATEMENT (STMT,...)

CC Statement. Hold multiple statements as if one.
Required Usual Form. {STMT ...}.
Function Form STATEMENT(STMT,...) May be syntatically invalid.

Arguments STMT,... must be statements. Simple statements end with
a semicolon (;), compound statements are in braces ({}).

Result.. None.

Example. IF (_X[2]) {
_B = 2;
_C = 3;
}.

std_dev (ARRAY,[DIM],[MASK])

Transformation. Standard deviation of the elements of ARRAY along
dimension DIM corresponding to the true elements of
MASK. The std_dev value is the square root of the sum of
squares of the difference from the average of the
elements divided by one less than the number of entries.

Arguments Optional: DIM, MASK.
ARRAY floating point array.
DIM integer scalar from 0 to n-1, where n is rank of ARRAY.
MASK logical and conformable to ARRAY.

Signals. Same as ARRAY if DIM-th or all dimensions omitted.
Units... Same as ARRAY.
Form.... Same type as ARRAY. It is a scalar if DIM is absent or
ARRAY is scalar or vector. Otherwise, the result is an
array of rank n-1 and shaped like ARRAY with DIM
subscript omitted.

Result.. The result without DIM is the std_dev value of the
elements of ARRAY, testing only those with true MASK
values and value not equal to $ROPRAND. With DIM, the
value of an element of the result is std_dev of the
ARRAY elements with DIM dimension fixed as the element
number of the result. If no value is found, zero is
returned.

Examples. STD_DEV([1,2,3]) is SQRT(2./2). STD_DEV(_C,,_C GT 0)
finds the std_dev of positive element of C.
If _B=[1 3 5], STD_DEV(_B,0) is SQRT([1.,1.,1.]/1) and
[2 4 6]
STD_DEV(_B,1) is SQRT([4.,4.]/2).

string (X,[Y],...[FORMAT])

Transformation. Converts data to a text string.

Arguments Optional: Y, FORMAT.
X any type that can be converted to character.
Y,... more arguments. If present, FORMAT must be present.
FORMAT character scalar to control the conversion.

Signals. None.
Units... None.
Form.... Character scalar.

Result.. ??

Example. ??

STRING_OPCODE (STRING)

MDS Character Elemental. Convert string to an opcode value.

Argument. STRING must be character.

Signals. Same as STRING.
Units... None, bad if STRING has units.
Form.... Unsigned word.

Result.. The number associated with the opcode name.
Opcode names are like "OPC$STRING_OPCODE".

Example. STRING_OPCODE('$') is 0.

SUBSCRIPT (X,[SUB],...)

CC-F90 Modified Operation. Pick certain element of an expression.
Usual Form X[ SUB,... ]. (The Brackets are required.)
Function Form SUBSCRIPT(X,[SUB],...).

Arguments Optional: SUB,....
X array or signal.
SUB,... ranges, vector lists, scalars.
>>>>>>>>>WARNING, the number of subscripts must not exceed
the rank of X.
>>>>>>>>>WARNING, if X is a signal and the subscripted dimension
exists and SUB is a explicit
range without a delta, then all valid subscripts
between the begin and end values of the range
are used. This behavior may be forced for more
complex expressions of SUB by using $VALUE as
the delta of a range.

Signals. Same as X. The trailing scalar axes are removed.
For non-trailing-scalar axes the axis is valid values
selected to match the SUB values.
Units... Same as X.
Form.... Type of X and shape dependent on number of valid
elements in each subscript.

Result.. The selected values from X. For signals, the SUB values
are truncated by CULL and converted by X_TO_I to
indices. The nearest integral value is used. For
non-signals, the values are culled and used to select
values from X.

Examples. [1,2,3][2] is 3. [1,2,3][3] is [] a null vector.
Build_signal(1:100,*,build_dim(*,.01:1:.01))[.2:.25]
is build_signal([20,21,22,23,24,25],*,
[.2,.21,.22,.23,.24,.25]).

See also. EXTEND to continue endpoint values to prevent culling.
MAP to use offsets into the array X.
NINT to round indices to the nearest integers.

SUBTRACT (A,B)

Numeric Elemental. Subtract numbers.
Usual Form A - B.
Function Form SUBTRACT(A,B).

Arguments A and B must be numeric.

Signals. Single signal or smaller data.
Units... Single or common units, else bad.
Form.... Compatible form of A and B.

Result.. The element-by-element difference of objects A and B.
>>>>>>>>>WARNING, integer overflow is ignored.

Example. [2,3,4] - 5.0 is [-3.0,-2.0,-1.0].

SUM (ARRAY,[DIM],[MASK])

F90 Transformation. Sum of all the elements of ARRAY along dimension
DIM corresponding to the true elements of MASK.

Arguments Optional: DIM, MASK.
ARRAY numeric array.
DIM integer scalar from 0 to n-1, where n is rank of ARRAY.
MASK logical and conformable to ARRAY.

Signals. Same as ARRAY if DIM-th or all dimensions omitted.
Units... Same as ARRAY.
Form.... Same type as ARRAY. It is a scalar if DIM is absent or
ARRAY is scalar or vector. Otherwise, the result is an
array of rank n-1 and shaped like ARRAY with DIM
subscript omitted.

Result. The result without DIM is the sum of the elements of
ARRAY, using only those with true MASK values.

Reserved operand ($ROPRAND) values are included.

To ignore $ROPRAND values replace ARRAY with FIX_ROPRAND(ARRAY,0).



Examples. SUM([1,2,3]) is 6. SUM(_C,,_C GT 0) finds the sum of all
positive element of C. If _B=[1 3 5],
[2 4 6]
SUM(_B,0) is [3,7,11] and SUM(_B,1) is [9,12].

SWITCH (X,STMT,...)

CC Statement. Select from cases presented in the statement.
Required Usual Form. SWITCH (X) STMT.
Function Form SWITCH(X,STMT,...). May be syntatically invalid.

Arguments
X any scalar that can be compared.
STMT statement, simple or {compound}.
>>>>>>WARNING, multiple statements in call form are considered
to be in braces.

Result.. None.

Example. SWITCH (_k) {
CASE (1) _j=_THING1; BREAK;
CASE (4.5:5.5) _j=_OTHER_THING; BREAK;
CASE DEFAULT ABORT();
}.

system_clock (STRING)

F90 Modified IO. Integer data from the real-time clock. ??

Argument. STRING is character scalar. One of the strings COUNT,
COUNT_RATE, or COUNT_MAX.

Signals. Same as STRING.
Units... None, bad if STRING has units.
Form.... Integer scalar.

Result.. Depends on the time of day.

Example. If the basic system clock registers time in 0.01 second
intervals, at 11:30 then on a VAX:
SYSTEM_CLOCK("COUNT") is ((11*60+30)*60)/0.01=4140000,
SYSTEM_CLOCK("COUNT_RATE") is 100,
SYSTEM_CLOCK("COUNT_MAX") is 24*60*60/0.01-1=8639999.