Documentation:Reference:tdi grouped - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search
TDISHR Grouped_Intrinsics
The intrinsics grouped by their function.

Compiling_Intrinsics

These routines help with compiling and decompiling:
AS_IS COMPILE COMPILE_DEPENDENCY DEBUG
DECOMPILE DECOMPILE_DEPENDENCY EVALUATE EXECUTE
EXT_FUNCTION REM
CALL [notation: image->routine:type(arg...)]

In a CALL you can use DESCR REF VAL or XD functions of the arguments.

The immediate operator (`) causes one level of evaluation in compiling. The immediate operator must not be used on a COMPILE or EXECUTE because compilation depends on static variables and is not reentrant. A few operation execute immediately on VMS arguments. They include builds, type conversion, and signing. The _OF routines should not have VMS arguments so they are immediate to produce an error. VMS arguments are numbers and text, either static or dynamic, and either scalar or array.

Constant_Intrinsics

TDISHR permits expressions with some defined or measured constants.
These symbolic forms are easier to read and are normally more accurate than you would enter.
Major sources:
"The 1986 Adjustment of the Fundamental Physical Constants..."
by Cohen and Taylor as listed in "Physics Today" August 1990.
"1980 Revised NRL Plasma Formulary" by Book.

The names appear with a dollar sign ($) and without parentheses.

Name Value Units (Error) Symbol Description
$2PI 6.2831853072 -- circumference/radius
$A0 a0 5.29177249e-11 m (24) Bohr radius
$ALPHA 7.29735308e-3 (33) fine-structure constant
$AMU u 1.6605402e-27 kg (10) unified atomic mass unit
$ATM atm 1.01325e5 Pa (exact) atmospheric pressure
$C c 299792458. m/s (exact) speed of light
$CAL cal 4.1868 J  ? calorie
$DEGREE .01745329252 -- pi/180
$EPSILON0 8.854187817e-12 F/m -- permitivity of vacuum
$EV eV 1.60217733e-19 J/eV (49) electron volt
$FALSE 0 -- logically false
$FARADAY F 9.6485309e4 C/mol (29) Faraday constant
$G G 6.67259e-11 m^3/s^2/kg (85) gravitational constant
$GAS R 8.314510 J/K/mol (70) gas constant
$GN gn 9.80665 m/s^2 (exact) acceleration of gravity
$H h 6.6260755e-34 J*s (40) Planck constant
$HBAR 1.05457266e-34 J*s (63) h/(2pi)
$I i cmplx(0,1) -- imaginary
$K k 1.380658e-23 J/K (12) Boltzmann constant
$ME me 9.1093897e-31 kg (54) mass of electron
$MP mp 1.6726231e-27 kg (10) mass of proton
$MU0 12.566370614e-7 N/A^2 -- permeability of vacuum
$N0 n0 2.686763e25 /m^3 (23) Loschmidt's number
$NA NA or L 6.0221367e23 /mol (36) Avogadro number
$P0 atm 1.01325e5 Pa (exact) atmospheric pressure
$PI 3.1415926536 -- circumference/diameter
$QE e 1.60217733e-19 C (49) charge on electron
$RE re 2.81794092e-15 m (38) classical electron rad.
$RYDBERG Rinf 1.0973731534e7 /m (13) Rydberg constant
$T0 273.16 K  ? standard temperature
$TORR torr 1.3332e2 Pa  ? 1mm Hg pressure
$TRUE 1bu -- logically true


$DEFAULT character string path in current tree
$EXPT character string experiment name of current tree
$MISSING special missing argument
$NARG special actual FUN argument count
$SHOT long shot number of current tree
$SHOTNAME character string shot number as text
$THIS signal/param signal descriptor in a signal or param descriptor in a param
$VALUE special raw field in a signal or value field in a param or subscript dimensional increment


$DEFAULT, $EXPT, and $SHOT are special calls to GETDBI.

$MISSING is used internally to mark a missing argument and gives zero or blanks. $MISSING and $ROPRAND execute at compilation.

$NARG is used in a FUN to get the actual number of arguments--thus its value depends on where it is used.

$THIS is set by GET_DATA of a signal or param to that descriptor.

$VALUE is used in the data field of a signal to mean the raw field and in the validation field of a param to mean the value field. $VALUE is like RAW_OF($THIS) for signals and like VALUE_OF($THIS) for params.

Elemental_Intrinsics

Much of the power of TDISHR comes from working with vectors and arrays just as if they were scalars. For many of the operations, each element of the array is operated on by a function. Data types are matched for functions of more than one argument including matching scalars with arrays and floats with integers. These operations are the elementals.

Bit-wise:
BTEST IAND IAND_NOT IBCLR
ibits IBSET IEOR IEOR_NOT
INAND INAND_NOT INOR INOR_NOT
INOT IOR IOR_NOT

Character:
ACHAR ADJUSTL ADJUSTR BUILTIN_OPCODE
CHAR CONCAT ELEMENT EXTRACT
IACHAR ICHAR INDEX LEN_TRIM
LGE LGT LLE LLT
REPEAT SCAN STRING_OPCODE TRANSLATE
UPCASE VERIFY

Conversion:
BYTE BYTE_UNSIGNED CMPLX CVT
DBLE D_COMPLEX D_FLOAT FLOAT
F_COMPLEX F_FLOAT G_COMPLEX G_FLOAT
H_COMPLEX H_FLOAT INT INT_UNSIGNED
LOGICAL LONG LONG_UNSIGNED OCTAWORD
OCTAWORD_UNSIGNED QUADWORD
QUADWORD_UNSIGNED REAL SIGNED
TEXT UNSIGNED WORD WORD_UNSIGNED

Logical:
AND AND_NOT EQ EQV
FINITE GE GT is_in
LE LT MERGE NAND
NAND_NOT NE NEQV NOR
NOR_NOT NOT OR OR_NOT

Mathematical:
ACOS ACOSD ARG ARGD
ASIN ASIND ATAN ATAN2
ATAN2D ATAND ATANH COS
COSD COSH EXP LOG
LOG10 LOG2 SIN SIND
SINH SQRT TAN TAND
TANH

Numeric:
ABS ABS1 ABSSQ ADD
AIMAG AINT ANINT BSEARCH
CEILING CONJG DIM DIVIDE
DPROD EXPONENT FIX_ROPRAND FLOOR
FRACTION ISHFT ISHFTC MAX
MIN MOD modulo MULTIPLY
nearest NINT POWER RRSPACING
SCALE SET_EXPONENT SHIFT_LEFT SHIFT_RIGHT
sign SPACING SQUARE SUBTRACT
UNARY_MINUS UNARY_PLUS

Variable:
POST_DEC POST_INC PRE_DEC PRE_INC

The shape of the result is derived from conforming the arguments-- for example, scalar with vector is a vector. A few operations expect arguments that are scalars or tables and cannot conform them: BSEARCH: TABLE, AINT/ANINT/CHAR/CMPLX/FLOAT/INT/NINT/REAL/TEXT: KIND, CVT: MOLD, is_in: SET, REPEAT: NCOPIES.

The "signality" of the result is the signality of the dominant shape. Keeping signality is the embedding of an expression using a signal back into its signal form. For example, BUILD_SIGNAL(42*$VALUE,6) + 5, becomes a signal, BUILD_SIGNAL(257,6) when used.

The units of the result is the appropriate mixing of the units of the arguments.

Inquiry_Intrinsics

These routines return information about the system or values:
ALLOCATED BIT_SIZE DIGITS ELBOUND
EPSILON ESHAPE ESIZE EUBOUND
HUGE KIND LBOUND LEN
MAXEXPONENT MINEXPONENT PRECISION PRESENT
RADIX RANGE RANK
SELECTED_INT_KIND SELECTED_REAL_KIND SHAPE
SIZE SIZEOF TINY UBOUND

IO_Intrinsics

Input/output operations interact with the operating system and should be avoided in coding operations for tree expressions because of their side effects.
backspace date_and_time DATE_TIME endfile
EXT_FUNCTION FCLOSE FOPEN FSEEK
FTELL inquire read rewind
FSEEK SHOW_PRIVATE SHOW_PUBLIC SPAWN
system_clock WAIT WRITE

>>>>>>>>>WARNING, many of these have side effects.

MDS_Intrinsics

These operations construct and access MDS and VMS descriptors.

MDS Construction:

BUILD_ACTION BUILD_CALL BUILD_CONDITION BUILD_CONGLOM
BUILD_DEPENDENCY BUILD_DIM BUILD_DISPATCH
BUILD_EVENT BUILD_FUNCTION BUILD_METHOD BUILD_PARAM
BUILD_PATH BUILD_PROCEDURE BUILD_PROGRAM BUILD_RANGE
BUILD_ROUTINE BUILD_SIGNAL BUILD_SLOPE BUILD_WINDOW
BUILD_WITH_UNITS
MAKE_ACTION MAKE_CALL MAKE_CONDITION MAKE_CONGLOM
MAKE_DEPENDENCY MAKE_DIM MAKE_DISPATCH MAKE_FUNCTION
MAKE_METHOD MAKE_PARAM MAKE_PROCEDURE MAKE_PROGRAM
MAKE_RANGE MAKE_ROUTINE MAKE_SIGNAL MAKE_SLOPE
MAKE_WINDOW MAKE_WITH_UNITS

MDS Fields:

CLASS DSCPTR KIND NDESC
ARG_OF AXIS_OF BEGIN_OF CLASS_OF
COMPLETION_OF COMPLETION_MESSAGE_OF CONDITION_OF
DIM_OF DISPATCH_OF DSCPTR_OF END_OF
ERRORLOGS_OF HELP_OF IDENT_OF IMAGE_OF
INTERRUPT_OF KIND_OF LANGUAGE_OF
METHOD_OF MODEL_OF NAME_OF NDESC_OF
OBJECT_OF PERFORMANCE_OF PHASE_OF PROCEDURE_OF
PROGRAM_OF QUALIFIERS_OF RAW_OF ROUTINE_OF
SLOPE_OF TASK_OF TIME_OUT_OF UNITS_OF
VALIDATION_OF VALUE_OF WHEN_OF WINDOW_OF
$THIS $VALUE

MDS Information:

BUILTIN_OPCODE CULL DATA DATA_WITH_UNITS
EXTEND GETDBI GETNCI I_TO_X
OPCODE_BUILTIN OPCODE_STRING STRING_OPCODE
UNITS USING VALIDATION X_TO_I

Miscellaneous_Intrinsics

These routines do not fall in any other category.
ABORT decode DECOMPRESS encode
fit IF_ERROR intersect on_error
randomseed solve SORT SORTVAL

>>>>>>>>>WARNING, some have side effects.

Statement_Intrinsics

These opcodes are similar to C-language statements.
BREAK CONTINUE FOR GOTO
IF ... ELSE STATEMENT SWITCH WHILE

Some are modified to permit proper compilation with a minimum of reserved words.
CASE DO LABEL RETURN

These are like CC expressions.
COMMA CONDITIONAL

These are F90-like extensions.
CASE DEFAULT where ... elsewhere

>>>>>>>>>WARNING, the "bare" tree names
BREAK CONTINUE ELSE (after IF statement) ELSEWHERE (after
WHERE statement) will not be acceptable to the compiler.
Use a leading colon (:) or choose another name.

>>>>>>>>>WARNING, while it is possible to create expressions with a statement subexpression, the result cannot be re-compiled (except for the standard statements) because the semicolon, keyword, or brace is syntactically wrong.

Transformation_Intrinsics

These operations change information into new blocks of information.

Generation:
ARRAY BUILD_DTYPE_RANGE DTYPE_RANGE
promote RAMP RANDOM REPLICATE
SPREAD VECTOR ZERO

Masking:
ALL ANY COUNT FIRSTLOC
LASTLOC

Mathematics:
ACCUMULATE convolve derivative fft
integral interpol median rc_droop
rebin

Matrix:
DIAGONAL DOT_PRODUCT inverse matmul
mat_rot mat_rot_int smooth transpose
transpose_mul

Reduction:
MAXLOC MAXVAL MEAN MINLOC
MINVAL PRODUCT rms std_dev
SUM TRIM

Selection:
cshift eoshift MAP PACK
SORT SORTVAL SUBSCRIPT UNION
unpack

Shaping and typing:
reshape SET_RANGE string transfer

>>>>>>>>>WARNING, RANDOM has a side effect on the seed.

Although a few of these produce the same sized output as their input, the result depend on other elements. (One-for-one operations are elementals.)

Variable_Intrinsics

Opcodes associated with variables are:
ALLOCATED DEALLOCATE FUN PRESENT
RESET_PRIVATE RESET_PUBLIC SHOW_PRIVATE SHOW_PUBLIC
VAR

Variable names may be preceded by PRIVATE or PUBLIC to restrict the search for them.

Function descriptions may use IN INOUT OPTIONAL and OUT modes.

Of special interest are EQUALS (x=expr) EQUALS_FIRST (x+=expr, etc.) POST_DEC (x--) POST_INC (x++) PRE_DEC (--x) and PRE_INC (++x) and subscripting (x[expr]) and mapping (MAP(x,expr)).