Documentation:Reference:TDI A1 - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

ABORT ([ANY],...)

Miscellaneous. Abort an expresion by causing an error.

Arguments Any, ignored.

Result.. None, error status.

Example. IF_ERROR(A,B,ABORT()) aborts if both members are bad.

ABS (A)

F90 Numeric Elemental. Absolute value.

Argument. A must be numeric.

Signals. Same as A.
Units... Same as A.
Form.... Same as A except if A is complex, the result is real.

Result.. Unsigned integers are unchanged, negative integers and reals are negated, complex numbers get square roots of the sum of the squares of real and imaginary parts. The complex number parts are scaled to avoid overflow.

Example. ABS(CMPLX(3.0,4.0)) is 5.0.

See also. ABS1 and ABSSQ for complex number to avoid a square root. ARG for the complex angle.

ABS1 (A)

Numeric Elemental. Absolute value with L1 norm.

Argument. A must be numeric.

Signals. Same as A.
Units... Same as A.
Form.... Same as A except if A is complex, the result is real.

Result.. Unsigned integers are unchanged, negative integers
and reals are negated, complex numbers become the sums
of the absolute values of the real and imaginary parts.

Example. ABS1(CMPLX(3.0,-4.0)) is 7.0.

ABSSQ (A)

Numeric Elemental. Absolute value squared.

Argument. A must be numeric.

Signals. Same as A.
Units... Same as for A * A.
Form.... Same as A except if A is complex, the result is real.

Result.. Integers may lose significance. Integers and reals are
squared, complex numbers become the sums of the squares
of the real and imaginary parts.

Example. ABSSQ(CMPLX(3.0,4.0)) is 25.0.

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

Transformation. Running 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.
Units... Same as ARRAY.
Form.... Same type and shape as ARRAY.
Result.. The result is the running sum of the elements of
ARRAY, using only those with true MASK values and value
not equal to the reserved operand ($ROPRAND). With DIM,
the value of an element of the result is the running sum of
the ARRAY elements with dimension DIM fixed as the element
number of the result. Without DIM, the result is the sum
from the first element ignoring the shape.
If no value is found, 0 is given.

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

ACHAR (I)

F90 Character Elemental. The character in a specified position of the
ASCII collating sequence. The inverse of IACHAR.

Argument. I must be integer.

Signals. Same as I.
Units... Same as I.
Form.... Length-one character of same shape.

Result.. For j between 0 and 127, the result is the character in
position j of the ASCII collating sequence; otherwise,
the result is processor dependent. It is truncated to
8 bits on the VAX.

Example. ACHAR(88) has the value 'X'.

See also. CHAR and its inverse ICHAR for a processor-dependent.

ACOS (X)

F90 Mathematical Elemental. Arccosine (inverse cosine).

Argument. X must be real and be less than 1 in magnitude.
Complex numbers cause an error.

Signals. Same as X.
Units... None, bad if X has units.
Form.... Real of same shape.

Result.. Processor approximation to arccos(X) == in radians.
It lies in the range 0 to pi, inclusive.
Out-of-range numbers get $ROPRAND.

Example. ACOS(0.54030231) is 1.0, approximately.

ACOSD (X)

Mathematical Elemental. Arccosine (inverse cosine) in degrees.

Argument. X must be real and be less than 1 in magnitude.
Complex numbers cause an error.

Signals. Same as X.
Units... None, bad if X has units.
Form.... Real of same shape.

Result.. Processor approximation to arccos(X) == in degrees.
It lies in the range 0 to 180.
Out-of-range numbers get $ROPRAND.

Example. ACOSD(0.5) is 60.0, approximately.

ADD (A,B)

Numeric Elemental. Add numbers.
Usual From A + B.
Function Form ADD(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 sum of objects A and B.
>>>>>>>>>WARNING, integer overflow is ignored.

Example. [2,3,4] + 5.0 is [7.0,8.0,9.0].

==ADJUSTL (STRING)

F90 Character Elemental. Adjust to the left, removing leading blanks
(and tabs) and inserting trailing blanks.

Argument. STRING must be character.

Signals. Same as STRING.
Units... Same as STRING.
Form.... Same as STRING.

Result.. Same as STRING except that any leading blanks and tabs
have been deleted and the same number of trailing blanks
have been inserted.

Example. ADJUSTL(' WORD') is "WORD ".

ADJUSTR (STRING)

F90 Character Elemental. Adjust to the right, removing trailing blanks
(and tabs) and inserting leading blanks.

Argument. STRING must be character.

Signals. Same as STRING.
Units... Same as STRING.
Form.... Same as STRING.

Result.. Same as STRING except that any trailing blanks and tabs
have been deleted and the same number of leading blanks
have been inserted.

Example. ADJUSTR('WORD ') is " WORD".

See also. TRIM (non-elemental) to remove trailing blanks and tabs.

AIMAG (Z)

F90 Numeric Elemental. Imaginary part of a complex number.

Argument. Z must be complex.

Signals. Same as Z.
Units... Same as Z.
Form.... Real of same shape.

Result.. Real with the same type parameter as Z.
If Z has the value CMPLX(x,y) the result is y.
Example. AIMAG(CMPLX(2.0,3.0)) is 3.0.

AINT (A,[KIND])

F90 Numeric Elemental. Trunctation to a whole number.

Argument. Optional: KIND.
A real. Complex numbers are an error.
KIND scalar integer type number, for example, KIND(1d0).

Signals. Same as A.
Units... Same as A.
Form.... Same as A.

Result.. Type is KIND if it is present, else that of A.
If |A|<1, AINT(A) == is 0; else AINT is largest integer
that does not exceed the magnitude of A and whose sign
is that of A. Overflow is not detected.

Examples. AINT(2.783) is 2.0. AINT(-2.783) is -2.0.

See also. INT for integer result and BYTE, WORD, LONG, QUADWORD,
OCTAWORD, and UNSIGNED_BYTE, etc., for specific forms.
ANINT and NINT for rounded integral value.

ALL (MASK,[DIM])

F90 Transformation. Determine if all values are true in MASK along
dimension DIM.

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

Signals. None.
Units... None.
Form.... Logical. It is scalar if DIM is absent or MASK is a
vector; otherwise, the result is an array of rank n-1
and of shape like MASK's with DIM subscript omitted.

Result.
(I) == ALL(MASK) is $TRUE if all elements of MASK are true or
if MASK has size zero and is $FALSE if any element of
MASK is false.
(ii) For a vector MASK, ALL(MASK,DIM) is equal to ALL(MASK).
Otherwise, the value of an element of the result is
ALL of the elements of MASK varying the DIM subscript.

Examples.
(I) == ALL([$TRUE,$FALSE,$TRUE]) is $FALSE.
(ii) For _B=[1 3 5] and _C=[0 3 5],
[2 4 6] [7 4 8]
ALL(_B NE _C,0) is [$TRUE,$FALSE,$FALSE].
ALL(_B NE _C,1) is [$FALSE,$FALSE].

See also. ANY for logical or, COUNT for the number of trues.

ALLOCATED (NAME)

F90 Variable Inquiry. Indicate if a variable is currently allocated.

Argument. NAME must be a variable name or a text string.

Signals. None.
Units... None.
Form.... Logical scalar.

Result.. $TRUE if NAME is currently allocated, otherwise $FALSE.

Example. ALLOCATED(_Not_in use) is $FALSE unless it has appeared
on the left side of an assignment expression.

See also. DEALLOCATE to remove names and RESET_PRIVATE or
RESET_PUBLIC for more drastic actions.

AND (L,M)

Logical Elemental. Logical intersection of elements.
Usual Forms L && M, L AND M.
Function Form AND(L,M).

Arguments L and M must be logical (lowest bit is 1 for true).

Signals. Single signal or smaller data.
Units... None unless both have units and they don't match.
Form.... Logical of compatible shape.

Result.. True if both are true; otherwise, false.
>>>>>>>>>WARNING, do not confuse with & which is bit-wise IAND.

Example. [0,0,1,1] && [0,1,0,1] is [$FALSE,$FALSE,$FALSE,$TRUE].
See also. EQV, NAND, NEQV, NOR, OR, and others like AND_NOT for
other logical functions.

AND_NOT (L,M)

Logical Elemental. Logical intersection with negation of second.
Accepted Form. L AND_NOT M.

Arguments L and M must be logical (lowest bit is 1 for true).

Signals. Single signal or smaller data.
Units... None unless both have units and they don't match.
Form.... Logical of compatible shape.

Result.. True if L is true and M is false; otherwise, false.

Example. [0,0,1,1] AND_NOT [0,1,0,1] is
[$FALSE,$FALSE,$TRUE,$FALSE].

ANINT (A,[KIND])

F90 Numeric Elemental. Nearest whole number.

Argument. Optional: KIND.
A real. Complex numbers are an error.
KIND scalar integer type number, for example, KIND(1d0).

Signals. Same as A.
Units... Same as A.
Form.... Same as A.

Result.. Type is KIND if it is present, else that of A.
If A>0, ANINT(A) == is AINT(A+0.5); else, ANINT(A) == is
AINT(A-0.5).

Examples. ANINT(2.783) is 3.0. ANINT(-2.783) is -3.0.

See also. NINT for integer and INT and AINT for truncated results.