Documentation:Reference:TDI PQ - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

PACK (ARRAY,MASK,[VECTOR])

F90 Transformation. Pack an array into a vector under control of a
mask.

Arguments Optional: VECTOR.
ARRAY any type.
MASK logical conformable to ARRAY.
VECTOR ARRAY's type, length at least equal to last true element
of MASK.

Signals. The single signal or the smallest.
Units... The single or matching units, else bad.
Form.... The type is from ARRAY, ARRAY. The shape is rank one
equal to the number of trues if no VECTOR or the shape
of VECTOR if present. If no VECTOR and MASK is a scalar
true, the result is ARRAY shaped.

Result.. The elements as selected by MASK from ARRAY. The
remaining elements are filled from VECTOR.

Examples. Gather the nonzero elements of M = [0,0,0].
[9,0,0]
[0,0,7]
PACK(M,M NE 0) is [9,7] and
PACK(M,M NE 0,[2,4,6,8,10,12]) is [9,7,6,8,10,12].

PERFORMANCE_OF (A)

MDS Operation. Get the performance field.

Argument. Descriptor as below.

Result.. A is searched for this:
DSC$K_DTYPE_ACTION, the performance statistics field.
Otherwise, an error.

PHASE_OF (A)

MDS Operation. Get the phase field.

Argument. Descriptor as below.

Result.. A is searched for this:
DSC$K_DTYPE_DISPATCH, the phase field.
Otherwise, an error.

POST_DEC (NAME)

Variable Elemental. Decrement variable but give old value.
Usual Form NAME--.
Function Form POST_DEC(NAME).

Argument. NAME must be a variable with numeric value or operator
on variable.

Signals. Same as NAME.
Units... Same as NAME.
Form.... Same as NAME.

Result.. Old value of NAME.

Side Effect. NAME is now one less than before.

Example. For _A=6, A-- is 6 and _A is now 5.

POST_INC (NAME)

Variable Elemental. Increment variable but give old value.
Usual Form NAME++.
Function Form POST_INC(NAME).

Argument. NAME must be a variable with numeric value or operator
on variable.

Signals. Same as NAME.
Units... Same as NAME.
Form.... Same as NAME.

Result.. Old value of NAME.

Side Effect. NAME is now one more than before.

Example. For _A=6, A++ is 6 and _A is now 7.

POWER (X,Y)

Numeric Elemental. Raise number to a power.
Usual Forms X^Y, X**Y.
Function Form POWER(X,Y).

Arguments X and Y must be numeric.

Signals. Single signal or smaller data.
Units... None, bad if X or Y have units.
Form.... The compatible form of X and Y if both are byte, word,
or long or both are real or complex; otherwise, the type
of X.
>>>>>>>>>WARNING, long unsigned and longer integer types are truncated.
>>>>>>>>>WARNING, quad-precision complex--HC^HC is truncated to GC^GC.

Result.. Converts integer exponents to long and takes integral
power. For real, or complex powers gives EXP(LOG(X)*Y).
This will be $ROPRAND if X is not positive.
>>>>>>>>>WARNING, 0.0^0 is not detected as an error and results in 1.0.
>>>>>>>>>WARNING, do not use -X^2., which is (-X)^2.0, when you
mean -(X^2), because it will bomb. Note that negation
binds tighter than power.
>>>>>>>>>WARNING, use integer exponents when you mean that. For
example, X^2.0 is an order of magnitude slower than X^2.

Examples. 2^3 is 8. 2**0.5 is 1.41428, approximately, and is
better written as SQRT(2).

PRECISION (X)

Inquiry. The decimal precision in the model representing numbers of
the argument type.

Argument. X must be real or complex, scalar or array.

Signals. None.
Units... None.
Form.... Integer scalar.

Result.. INT((p-1)*LOG10(b))+k, where p is the number of fraction
digits, b is the digit size, and k is 1 if b is an
integral power of ten and 0 otherwise.

Example. PRECISION(1.0) is INT((24-1)*LOG10(2))=INT(6.92)=6
on the VAX.

PRESENT (A)

F90 Variable Inquiry. Determine if an optional argument present.

Argument. A must be an optional argument of the FUN in which
the PRESENT function reference appears.

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

Result.. $TRUE if A present or $FALSE otherwise.
Example. FUN _test(_A) {return PRESENT(_A);} when called _test()
is $FALSE and _test(3) is $TRUE.

PRE_DEC (NAME)

Variable Elemental. Decrement variable and give new value.
Usual Form --NAME.
Function Form PRE_DEC(NAME).

Argument. NAME must be a variable with numeric value or operator
on variable.

Signals. Same as NAME.
Units... Same as NAME.
Form.... Same as NAME.

Result.. New value of NAME.

Side Effect. NAME is now one less than before.

Example. For _A=6, --A is 5 and _A is now 5.

PRE_INC (NAME)

Variable Elemental. Increment variable and give new value.
Usual Form ++NAME.
Function Form PRE_INC(NAME).

Argument. NAME must be a variable with numeric value or operator
on variable.

Signals. Same as NAME.
Units... Same as NAME.
Form.... Same as NAME.

Result.. New value of NAME.

Side Effect. NAME is now one more than before.

Example. For _A=6, ++A is 7 and _A is now 7.

PRIVATE (NAME)

Variable Operation. Specifies the use of a private variable.
Usual Form PRIVATE NAME.

Argument. NAME must be a variable name.

Signals. None.
Units... None.
Form.... A copy of the contents of the variable.

Result.. That of the contents of the variable.

Example. PRIVATE _A = 42 sets the private variable _A to 42.

PROCEDURE_OF (A)

MDS Operation. Get the procedure field.

Argument. Descriptor as below.

Result.. A is searched for this:
DSC$K_DTYPE_PROCEDURE, the procedure field.
Otherwise, an error.

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

F90 Transformation. Product of all the elements of ARRAY along
dimension DIM corresponding to 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... Those of ARRAY repeated valid number of times.
(Today, none.)
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.
(i) Without DIM, the product of the elements of ARRAY, using
only those with true MASK values and value not equal to
the reserved operand.
(ii) With DIM, the value of an element of the result is the
product of ARRAY elements with dimension DIM fixed as
the element number of the result. If no value is found,
the number one is given.

Examples.
(i) PRODUCT([1,2,3]) is 6. PRODUCT(_C,,_C GT 0) finds the
product of all positive element of C.
(ii) If _B=[1 3 5],
[2 4 6]
PRODUCT(_B,0) is [2,12,30] and PRODUCT(_B,1) is [15,48].

PROGRAM_OF (A)

MDS Operation. Get the program field.

Argument. Descriptor as below.

Result.. A is searched for this:
DSC$K_DTYPE_PROGRAM, the program field.
Otherwise, an error.

project (ARRAY,MASK,FIELD,[DIM])

Transformation. Select masked values from an array.

Arguments Optional: DIM.
ARRAY any type array.
MASK logical array of same shape as ARRAY, must have at most
one true value.
FIELD same type as ARRAY. Scalar if no DIM, else rank n-1 with
same shape as ARRAY except that dimension DIM is
omitted.
DIM integer scalar from 0 to n-1, where n is rank of ARRAY.

Signals. Single signal or smallest of ARRAY or MASK.
Units... Single or common value of ARRAY or FIELD.
Form.... Type of ARRAY. Scalar if DIM is absent or ARRAY is a
vector, else rank n-1 and shape like ARRAY without
dimension DIM.

Result.
(i) Without DIM, the element of ARRAY corresponding to the
one true element of MASK. If no true elements, uses
FIELD.
(ii) With DIM, the resultant element is taken form ARRAY
element along the dimension DIM with FIELD omitting
subscript DIM.

Examples.
(i) _V=[1,2,3,4] and _P=[0,0,1,0], then
PROJECT(_V,_P,0) is 3.
PROJECT(_V,_V GT 5,99) is 3.
(ii) If _A=[1 4 7 10] and _L=[0 0 0 0], then
[2 5 8 11] [0 0 1 0]
[3 6 9 12] [0 0 0 0]
PROJECT(_A,_L,0) is 8.
PROJECT(_A,_L,[0,0,0],1) is [0,8,0], and
PROJECT(_A,_L,[0,0,0,0],0) is [0,0,8,0].
[0 2 0 0]
[0 3 5 0]
[1 4 6 0]
If _M=[0 0 0 0], then
PROJECT(_M,FIRSTLOC(_M NE 0,0),[-1,-1,-1,-1],0) is
[1,2,5,-1].

promote (NCOPIES,VALUE)

Transformation. Add a dimension, repeating the values.
Usual Form NCOPIES @ VALUE.
Function Form promote(NCOPIES,VALUE)

Arguments
NCOPIES integer scalar or vector.
VALUE any type, scalar or array.
Signals. Same as VALUE with highest dimension increased. (?)
Units... Same as VALUE.
Form.... The VALUE's type with more dimension(s).

Result.. NCOPIES of VALUE will be place end to end.

Example. [1,3]@[5,4] is [5,4, 5,4, 5,4] with shape [2,1,3].
See also REPLICATE and SPREAD.

PUBLIC (NAME)

Variable Operation. Specifies the use of a public variable.
Usual Form PUBLIC NAME.

Argument. NAME mus be a variable name.

Signals. Same as NAME.
Units... Same as NAME.
Form.... A copy of the contents of the variable.

Result.. That of the contents of the variable.

Example. PUBLIC _A = 42 sets the public variable _A to 42.

QUADWORD (A)

Conversion Elemental. Convert to quadword (8-byte) integer.

Argument. A must be numeric.

Signals. Same as A.
Units... Same as A.
Form.... Quadword-length integer.

Result.. The truncated whole part of A.
Immediate at compilation.
>>>>>>>>>WARNING, truncation does not cause an error.
Examples. QUADWORD(123) is 123O. QUADWORD(65537) is 65537O.

QUADWORD_UNSIGNED (A)

Conversion Elemental. Convert to quadword (8-byte) unsigned integer.

Argument. A must be numeric.

Signals. Same as A.
Units... Same as A.
Form.... Quadword-length unsigned integer.
Result.. The truncated whole part of A.
Immediate at compilation.
>>>>>>>>>WARNING, truncation does not cause an error.

Example. QUADWORD_UNSIGNED(123) is 123oU.

QUALIFIERS_OF (A)

MDS Operation. Get the qualifiers field.

Argument. Descriptor as below.

Result.. A is searched for these:
DSC$K_DTYPE_CALL, the type byte unsigned.
DSC$K_DTYPE_CONDITION, the modifier unsigned word.
DSC$K_DTYPE_CONGLOM, the qualifiers field.
DSC$K_DTYPE_DEPENDENCY, the opcode unsigned word.
DSC$K_DTYPE_DISPATCH, the type byte unsigned.
DSC$K_DTYPE_FUNCTION, the opcode unsigned word.
Otherwise, an error.

Example. QUALIFIER_OF(A+B) is 38 (at this writing).