Documentation:Reference:TDI F - MdsWiki
Navigation
Personal tools

From MdsWiki

Jump to: navigation, search

FCLOSE (UNIT)

CC IO. Close the file unit opened by FOPEN.

Argument UNIT long integer pointer from FOPEN.

Result.. Error code or 0 if none.

Example. See FOPEN.

fft (ARRAY,[DIM],S)

Transformation. Do a Finite Fourier Transform.

Arguments Optional: DIM.
ARRAY real or complex array.
DIM integer scalar from 0 to n-1, where n is rank of ARRAY.
S integer scalar for direction of the transform.

Signals. Same as ARRAY with DIM-th dimension replaced by ramp.
(Today, none.)
Units... Same as ARRAY / DIM_OF(ARRAY,DIM)^2. (Today, none.)
Form.... Complex array of same shape as X.

Result.. Each element of ARRAY is replaced by the tranform using
elements along dimension DIM.
Example. ??

FINITE (X)

Logical Elemental. Checks that a number is not the reserved real value.

Argument X is real.

Signal.. Same as X.
Units... None.
Form.... Logical of same shape as X.

Result.. Each element of X is checked for validity as a floating
point number. All integers are finite.

Examples. FINITE(1.) is 1BU, FINITE(1./0) is 0BU.

FIRSTLOC (MASK,[DIM])

Transformation. Locate the leading edges of a set of true
elements of a logical mask.

Arguments Optional: DIM.
MASK logical array.
DIM integer scalar from 0 to n-1, where n is rank of MASK.
Signals. Same as MASK.
Units... None.
Form.... Logical of same shape.

Result.
(i) FIRSTLOC(MASK) has at most one true element. If there is
a true value, it is the first in array element order.
(ii) FIRSTLOC(MASK,DIM) is found by applying FIRSTLOC to each
of the one-dimensional array sections of MASK that lie
parallel to dimension DIM.

Examples.
(i) First in array order:
FIRSTLOC(_M=[0 0 1 0]) is [0 0 0 0].
[0 1 1 0] [0 1 0 0]
[0 1 0 1] [0 0 0 0]
[0 0 0 0] [0 0 0 0]
(ii) the top edge:
FIRSTLOC(_M,0) is [0 0 1 0].
[0 1 0 0]
[0 0 0 1]
[0 0 0 0]

fit (GUESS,RESIDUALS)

Miscellaneous. Do a nonlinear least squares reduction of a function to
zero given a starting guess.

Arguments
GUESS real vector of n elements.
RESIDUALS an expression using variable name $X where the trial
values are to appear. There are m residuals of the fit.
Signals. Same as GUESS.
Units... Same as GUESS.
Form.... Same as GUESS.

Result.. The best approximation to the value minimizing FCN*FCN.

Example. The Rosenblock n=m=2 problem.
FIT([-1.2,1.0],[10*($X[2]-$X[1]^2),1.0-$X[1]]).

FIX_ROPRAND (X,REPLACE)

Numeric Elemental. Fix reserved operand value with substitute.
Arguments X and REPLACE must be real or complex.

Signals. Single signal or smaller data.
Units... Same as X.
Form.... Same as X.

Result.. Same as X except that elements with $ROPRAND value are
replaced by REPLACE. If X is real, the replacement is
the real part of REPLACE. If X is complex, the real and
imaginary parts are replaced independently.

Example. FIX_ROPRAND(1./0.,5) is 5.0.

FLOAT (A,[KIND])

Conversion Elemental. Convert to real.

Arguments Optional: KIND.
A numeric.
KIND scalar integer type number, for example, KIND(1d0).

Signals. Same as A.
Units... Same as A.
Form.... If KIND present, the type KIND; otherwise, the real
type with the same length. To get F, D, G, or H floating
result use F_FLOAT, etc.

Result.. Immediate at compilation.
(i) A is integer or real, the result is the truncated
approximation.
(ii) A is complex, the result is the approximation to the
real part.
>>>>>>>>>WARNING, truncation does not cause an error.

Examples. FLOAT(-3) is -3.0. FLOAT(Z,Z) is real part of a complex.
This is done in TDISHR as REAL(Z). In F90, REAL(Z) sets
the default floating point size.

FLOOR (A)

Numeric Elemental. The largest whole number not exceeding the argument.

Argument. A must be integer or real. Complex numbers are an error.

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

Result.. For integer A, no change. For real A>=0, AINT(A). For
real A<0, A if AINT(A)==A and AINT(A)-1 otherwise.

Examples. FLOOR(2.783) is 2.0. FLOOR(-2.783) is -3.0.

FOPEN (FILENAME,MODE)

CC IO. Open a file name.

Arguments
FILENAME character scalar with node, disk, file, and extension.
MODE character scalar: r for read, w for write, a for append,
and + for update may be added. Note lowercase.

Result.. Integer scalar, a pointer to a FILE block.

Example.. _u=FOPEN('myfile.ext','w'),WRITE(_u,_var),FCLOSE(_u).

FOR ([INIT],[TEST],[UPDATE],STMT...)

CC Statement. Initialize, test, and update a loop.
Required Usual Form. FOR (INIT; TEST; UPDATE) STMT.
Function Form FOR([INIT],[TEST],[UPDATE],STMT...).
May be syntatically invalid.

Arguments Optional: INIT, TEST, UPDATE.
INIT any expression.
TEST logical scalar.
UPDATE any expression.
STMT statement, simple or compound (like {S1 S2}).
>>>>>>WARNING, multiple statements (like S1 S2) in call form are
considered to be in braces.

Result.. None.

Example. FOR (_J=DSIZE(_X); --_J>=0; ) IF(_X[_J]) BREAK;

FRACTION (X)

F90 Numeric Elemental. Fractional part of the model representation of
the argument value.

Argument. X must be real or complex.

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

Result.. The value of X with the exponent set to its bias value.

Example. FRACTION(3.0) is 0.75 on the VAX.

FSEEK (UNIT,[OFFSET],[ORIGIN])

CC IO Position a file pointer.

Arguments Optional: OFFSET, ORIGIN.
UNIT Integer scalar pointer from FOPEN.
OFFSET Long scalar offset (w.r.t. ORIGIN) of file position.
ORIGIN Scalar number: 0 for absolute (w.r.t. beginning of file),
1 for relative to current position, 2 for offset from
end of file.

Result.. Error code or 0 if none.
>>>>>>WARNING, does not work properly for "record" files, only stream
files.

FTELL (UNIT,[OFFSET],[ORIGIN])

CC IO Report position of a file pointer.

Argument UNIT Integer scalar pointer from FOPEN.

Result.. Error code or 0 if none.
>>>>>>WARNING, does not work properly for "record" files, only stream
files.

FUN (NAME,STMT,[ARG],...)

Description. Define a function, its argument form, and the action
taken or invoke a function.
Usual Definition. FUN NAME([ARG],...) STMT
FUN PRIVATE NAME([ARG],...) STMT
FUN PUBLIC NAME([ARG],...) STMT.
Usual Invocation. NAME([X],...)
PRIVATE NAME([X],...)
PUBLIC NAME([X],...).
Function Form FUN(NAME,STMT,[ARG],...) May be syntatically invalid.
FUN(PRIVATE(NAME),STMT,[ARG],...)
FUN(PUBLIC(NAME),STMT,[ARG],...).

Arguments Optional: ARG,... X,....
NAME an alphanumeric name beginning with an underscore or a
dollar sign. The name defined and invoke must match
exactly. NAME may be preceded by PRIVATE or PUBLIC to
specify the scope of its definition. Default is PRIVATE.
A PRIVATE FUN is seen only by the routine defining it.
A PUBLIC FUN is seen by all routines.
ARG,... an alphanumeric name beginning with an underscore or a
dollar sign that will define the variable referenced in
STMT. Each argument may have modifiers IN, INOUT, or OUT
to specify the transfer of data between the calling and
the called routines. OPTIONAL may precede a modifier or
the variable name in an ARG. ARG marked as IN should not
be modified in STMT and never changes the actual input.
The default mode is IN.
STMT a statement form.
>>>>>>>>>WARNING, use care in tree pathnames used in PUBLIC FUN, they
will be relative to invocation, not to the definition.
PRIVATE FUN invocations are, of necessity, at that node.
X,... the actual instance of the arguments in the calling
routine. If the corresponding ARG is marked as INOUT or
OUT this must be a variable. If the corresponding ARG is
not marked OPTIONAL, then that X must be present and not
null.

Side Effect. NAME is allocated, any prior value is freed.
Result.. The argument expression of a RETURN statement or none.

Example. To create a function
FUN _SINCOSD(IN _ANGLE, OUT _SIN, OPTIONAL OUT _COS) {
_SIN = SIND(_ANGLE);
IF (PRESENT(_COS)) _COS = COSD(_ANGLE);
}
Then _SINCOSD(30,_Y,_X) sets _Y to 0.5 and _X to
0.8660254. This has no functional result.

Additional information available:

IN NAME INOUT NAME OPTIONAL NAME OUT NAME

IN NAME
FUN mode. Defines argument that is evaluated but not rewritten.
Argument. NAME must be a variable name.

INOUT NAME
FUN mode. Defines argument that is evaluate and rewritten when
the FUN finishes.
Argument. NAME must be a variable name.

OPTIONAL NAME
FUN mode. Defines argument that may be omitted in actual call.
Argument. NAME must be a variable name, or IN, INOUT, or OUT
before a name.

OUT NAME
FUN mode. Defines argument that is not evaluated, begins as undefined
in the FUN and is written when the FUN finishes.
Argument. NAME must be a variable name.

F_COMPLEX (X,[Y])

Conversion Elemental. Convert to F-precision floating complex.

Arguments Optional: Y.
X numeric.
Y numeric. Default is zero.

Signals. Single signal or smaller data.
Units... Single or common units, else bad.
Form.... F-precision complex of compatible shape.

Result.. If Y is absent and X is complex, the AIMAG(X) is used
for Y. If X and Y are present, the real parts of each
are used.
Immediate at compilation.
>>>>>>>>>WARNING, truncation does not cause an error.
Example. F_COMPLEX(3,4.1D0) is CMPLX(3.0,4.1), approximately.

F_FLOAT (A)

Conversion Elemental. Convert to F-precision floating real.

Argument. A must be numeric.

Signals. Same as A.
Units... Same as A.
Form.... F-precision real of same shape.

Result.. Integers, reals and the real part of complex numbers are
converted to F-precision reals.
Immediate at compilation.
>>>>>>>>>WARNING, truncation does not cause an error.

Example. F_FLOAT(12), F_FLOAT(12.) F_FLOAT(12H0) are 12.0,
approximately.