Home
Manual
Packages
Global Index
Keywords
Quick Reference

all functions  i
i86_primitives

i86_primitives, file
sets FILE primitive data types to be native to Linux i86 machines.
interpreted function, defined at i0/std.i line 2027

im_part

im_part(z)
returns the imaginary part of its argument.
Unlike z.im, works if z is not complex (returns zero).
interpreted function, defined at i0/std.i line 658

include

#include "yorick_source.i"
require, filename
include, filename
or include, filename, now
#include is a parser directive, not a Yorick statement. Use it
to read Yorick source code which you have saved in a file; the
file yorick_source.i will be read one line at a time, exactly as
if you had typed those lines at the keyboard. The following
directories are searched (in this order) to find yorick_source.i:
. (current working directory)
~/Yorick (your personal directory of Yorick functions)
Y_SITE/include (Yorick distribution library)
Y_SITE/contrib (contributed source at your site)
To find out what is available in the Yorick/include directory,
type:
library
You can also type
Y_SITE
to find the name of the site directory at your site, go to the
include or contrib subdirectory, and browse through the *.i files.
This is a good way to learn how to write a Yorick program. Be
alert for files like README as well.
The require function checks to see whether FILENAME has already
been included (actually whether any file with the same final
path component has been included). If so, require is a noop,
otherwise, the action is the same as the include function with
NOW == 1.
The include function causes Yorick to parse and execute FILENAME
immediately. The effect is similar to the #include parser
directive, except the finding, parsing, and execution of FILENAME
occurs at runtime. If the NOW argument is given and positive,
the include occurs immediately, if nil or 0, it occurs just before
the next line would have been parsed. If NOW is negative, the
include file is pushed onto a stack, and will be popped off and
parsed when all pending input has been processed.
Unless you are writing a startup file, or have some truly bizarre
technical reason for using the include function, use #include
instead. The functional form of include may involve recursive
parsing, which you will not be able to understand without deep
study. Stick with #include.
builtin function, documented at i0/std.i line 1483

SEE ALSO:

set_path,
Y_SITE

indgen

indgen(n)
or indgen(start:stop)
or indgen(start:stop:step)
returns "index generator" list  an array of longs running from
1 to N, inclusive. In the second and third forms, the index
values specified by the index range are returned.
builtin function, documented at i0/std.i line 892

SEE ALSO:

span,
spanl,
array

info

info, expr
prints the data type and array dimensions of EXPR.
interpreted function, defined at i0/std.i line 157

SEE ALSO:

help,
print

install_struct

install_struct, file, struct_name
or install_struct, file, struct_name, size, align, order
or install_struct, file, struct_name, size, align, order, layout
installs the data type named STRUCT_NAME in the binary FILE. In
the two argument form, STRUCT_NAME must have been built by one or
more calls to the add_member function. In the 5 and 6 argument calls,
STRUCT_NAME is a primitive data type  an integer type for the 5
argument call, and a floating point type for the 6 argument call.
The 5 argument form may also be used to declare opaque data types.
SIZE is the size of an instance in bytes, ALIGN is its alignment
boundary (also in bytes), and ORDER is the byte order. ORDER is
1 for most significant byte first, 1 for least significant byte
first, and 0 for opaque (unconverted) data. Other ORDER values
represent more complex byte permutations (2 is the byte order for
VAX floating point numbers). If ORDER equals SIZE, then the data
type is not only opaque, but also must be read sequentially.
LAYOUT is an array of 7 long values parameterizing the floating
point format, [sign_address, exponent_address, exponent_size,
mantissa_address, mantissa_size, mantissa_normalized, exponent_bias]
(the addresses and sizes are in bits, reduced to MSB first order).
Use, e.g., nameof(float) for STRUCT_NAME to redefine the meaning
of the float data type for FILE.
builtin function, documented at i0/std.i line 2472

SEE ALSO:

add_variable,
add_member

integ

integ(y, x, xp)
or integ(y, x, xp, which)
See the interp function for an explanation of the meanings of the
arguments. The integ function returns ypi which is the integral
of the piecewise linear curve (X(i), Y(i)) (i=1, ..., numberof(X))
from X(1) to XP. The curve (X, Y) is regarded as constant outside
the bounds of X. Note that X must be monotonically increasing or
builtin function, documented at i0/std.i line 987

SEE ALSO:

interp,
digitize,
span

integ_flat

integ_flat(opac, source, rays, mesh, slimits)
or integ_flat(opac, source, ray_paths)
returns ngroupby2bynrays result, where result(,1,..) is
the transparency factors, and result(,2,..) is the selfemission
for each group on each ray. The input OPAC and SOURCE are the
opacity (an inverse length) and the source function (a specific
intensity). They are meshbyngroups zone centered arrays. The
result has the same units as SOURCE.
In the second form, RAY_PATHS was returned by the track_rays
function.
interpreted function, defined at i0/drat.i line 1111

SEE ALSO:

integ_linear,
track_rays,
form_mesh,
streak,
snap

integ_linear

integ_linear(opac, source, rays, mesh, slimits)
or integ_linear(opac, source, ray_paths)
returns ngroupby2bynrays result, where result(,1,..) is
the transparency factors, and result(,2,..) is the selfemission
for each group on each ray. The input OPAC and SOURCE are the
opacity (an inverse length) and the source function (a specific
intensity). They are meshbyngroups arrays; OPAC is zone centered,
while SOURCE is point centered (using pcen_source). The result
has the same units as SOURCE.
In the second form, RAY_PATHS was returned by the track_rays
function.
The integ_linear routine assumes that the SOURCE function varies
linearly between the entry and exit points from each zone. This
assumption is poor near the turning point, and causes the result
to be a discontinuous function of the ray coordinates, unlike the
integ_flat result.
interpreted function, defined at i0/drat.i line 1154

SEE ALSO:

pcen_source,
integ_flat,
track_rays,
form_mesh,
streak,
snap

internal_rays

internal_rays(rays)
returns 6element (cos,sin,y,z,x,r) representation of RAYS.
The first dimension of RAYS may be length 3, 5, or 6 to represent
the ray(s) in TDG/DIRT coordinates (x,y,theta), "best" coordinates
(x,y,z,theta,phi), or internal coordinates (cos,sin,y,z,x,r),
respectively. The first dimension of the result always has length 6.
The internal coordinates are what Drat uses internally to
describe the ray. The coordinate system is rotated about the
zaxis until the ray lies in a plane of constant y (there are at
least two ways to do this). The point (x,y,z) can be any point on
the ray, and r=sqrt(x^2+y^2) is the corresponding cylindrical radius.
The clockwise angle theta from the +zaxis to the ray direction
(which always lies in the zxplane) determines cos=cos(theta) and
sin=sin(theta).
As a specification of a ray, this system is triply redundant because
the point (x,y,z) could be any point on the ray, both the sine and
cosine of theta appear, and r=sqrt(x^2+y^2).
However, the slimits parameter  used to specify the points along
a ray where the transport integration starts and stops  is
measured from the point (x,y,z) specified as a part of the
(cos,sin,y,z,x,r) ray coordinate. Thus, any change in the point
(x,y,z) on a ray must be accompanied by a corresponding change in
the slimits for that ray.
interpreted function, defined at i/rays.i line 155

SEE ALSO:

form_rays,
best_rays,
dirt_rays,
get_s0,
picture_rays

interp

interp(y, x, xp)
or interp(y, x, xp, which)
returns yp such that (XP, yp) lies on the piecewise linear curve
(X(i), Y(i)) (i=1, ..., numberof(X)). Points beyond X(1) are set
to Y(1); points beyond X(0) are set to Y(0). The array X must be
one dimensional, have numberof(X)>=2, and be either monotonically
increasing or monotonically decreasing. The array Y may have more
than one dimension, but dimension WHICH must be the same length as
X. WHICH defaults to 1, the first dimension of Y. WHICH may be
nonpositive to count dimensions from the end of Y; a WHICH of 0
means the final dimension of Y. The result yp has dimsof(XP)
in place of the WHICH dimension of Y (if XP is scalar, the WHICH
dimension is not present). (The dimensions of the result are the
same as if an index list with dimsof(XP) were placed in slot
WHICH of Y.)
builtin function, documented at i0/std.i line 968

SEE ALSO:

integ,
digitize,
span

interp2

z0= interp2(y0,x0, z,y,x)
or z0= interp2(y0,x0, z,y,x,reg)
return the bilinear interpolate of the function Z(X,Y) at the
points (X0,Y0). The X, Y, and optional REG arrays specify a
quadrilateral mesh as for the plm function. The Z values are
specified at the vertices of this mesh, so Z must have the
same dimensions as X and Y.
Points outside the mesh get the value 0.0, unless the outside
keyword is nonnil, in which case they get that value.
interpreted function, defined at i/digit2.i line 36

SEE ALSO:

interp,
digit2,
mesh_loc,
plm

ipq_setup

model= ipq_setup(x, u)
or model= ipq_setup(x, u, power=[pleft,prght])
or model= ipq_setup(x, u, power=[pleft,prght], slope=[sleft,srght])
compute a model for the ipq_compute function, which computes the
inverse of a piecewise quadratic function. This function occurs
when computing random numbers distributed according to a piecewise
linear function. The piecewise linear function is u(x), determined
by the discrete points X and U input to ipq_setup. None of the
values of U may be negative, and X must be strictly increasing,
X(i)0 while SRGHT<0. If either power is greater than or equal to
100, an exponential tail will be used. As a convenience, you may
also specify PLEFT or PRGHT of 0 to get an exponential tail.
Note: ipq_function(model, xp) returns the function values u(xp) at
the points xp, including the tails (if any). ipq_compute(model, yp)
returns the xp for which (integral from infinity to xp) of u(x)
equals yp; i.e. the inverse of the piecewise quadratic.
interpreted function, defined at i/random.i line 276

SEE ALSO:

random_ipq,
random_rej

is_array

is_array(object)
returns 1 if OBJECT is an array data type (as opposed to a function,
structure definition, index range, I/O stream, etc.), else 0.
An array OBJECT can be written to or read from a binary file;
nonarray Yorick data types cannot.
builtin function, documented at i0/std.i line 460

SEE ALSO:

is_func,
is_void,
is_range,
is_struct,
is_stream

is_present

is_present(get_vars(f), name)
returns 1 if variable NAME is present in file F, 0 if not.
interpreted function, defined at i0/drat.i line 891

is_prime

is_prime(x)
return nonzero if and only if X (which must be a scalar integer)
is prime. May return a false positive if X is greater than about
3e9, since at most 20000 candidate factors are checked.
The absolute value of X is taken first; zero is not prime, but 1 is.
interpreted function, defined at i/gcd.i line 64

SEE ALSO:

gcd,
lcm,
factorize

is_stream

is_stream(object)
returns 1 if OBJECT is a binary I/O stream (usually a file), else 0.
The _read and _write functions work on object if and only if
is_stream returns nonzero. Note that is_stream returns 0 for a
text stream  you need the typeof function to test for those.
builtin function, documented at i0/std.i line 497

SEE ALSO:

is_array,
is_func,
is_void,
is_range,
is_struct

