|
|
|
|
|
|
|
|
|
f_inverse
|
f_inverse(f_and_dfdx, y, x0, x1, xerr)
or f_inverse(f_and_dfdx, y, x0, x1, xerr)
Find values of an inverse function by Newton-Raphson iteration,
backed up by bisection if the convergence seems poor. The
subroutine F_AND_DFDX must be defined as:
func F_AND_DFDX (x, &f, &dfdx)
returning both the function value f(x) and derivative dfdx(x).
If the input x is an array, the returned f and dfdx must have
the same shape as the input x. If F_AND_DFDX always returns
zero dfdx, f_inverse will use bisection.
The result x will have the same shape as the input Y values.
The values of x are constrained to lie within the interval from
X0 to X1; the function value must be on opposite sides of the
required Y at these interval endpoints. The iteration stops
when the root is known to within XERR, or to machine precision
if XERR is nil or zero. X0, X1, and XERR may be arrays conformable
with Y.
f_inverse takes the same number of iterations for every Y value;
it does not notice that some may have converged before others.
unknown type function, documented at include/roots.i line 134
| |
| SEE ALSO: |
nraphson |
|
|
factorize
|
factorize(x)
return list of prime factors of X and their powers as an n-by-2
array. May include a large non-prime factor if X exceeds 3e9.
In any event, product(result(,1)^result(,2)) will equal abs(X).
X must be a scalar integer type.
unknown type function, documented at include/gcd.i line 94
| |
| SEE ALSO: |
gcd, |
|
|
fflush
|
fflush, file
flush the I/O buffers for the text file FILE. (Binary files are
flushed at the proper times automatically.) You should only need
this after a write, especially to a pipe.
unknown type function, documented at startup/std.i line 1207
| |
| SEE ALSO: |
write, |
|
|
fft
|
fft(x, direction)
fft(x, ljdir, rjdir)
or fft(x, ljdir, rjdir, setup=workspace)
returns the complex Fast Fourier Transform of array X.
The DIRECTION determines which direction the transform is in --
e.g.- from time to frequency or vice-versa -- as follows:
DIRECTION meaning
--------- -------
1 "forward" transform (coefficients of exp(+i * 2*pi*kl/N))
on every dimension of X
-1 "backward" transform (coefficients of exp(-i * 2*pi*kl/N))
on every dimension of X
[1,-1,1] forward transform on first and third dimensions of X,
backward transform on second dimension of X (any other
dimensions remain untransformed)
[-1,0,0,1] backward transform on first dimension of X, forward
transform on fourth dimension of X
etc.
The third positional argument, if present, allows the direction
of dimensions of X to be specified relative to the final dimension
of X, instead of relative to the first dimension of X. In this
case, both LJDIR and RJDIR must be vectors of integers -- the
scalar form is illegal:
LJDIR RJDIR meaning
----- ----- -------
[] [1] forward transform last dimension of X
[1] [] forward transform first dimension of X
[] [-1,-1] backward transform last two dimensions of X,
leaving any other dimensions untransformed
[-1,0,0,1] [] backward transform on first dimension of X,
forward transform on fourth dimension of X
[] [-1,0,0,1] backward transform on 4th to last dimension of X,
forward transform on last dimension of X
etc.
Note that the final element of RJDIR corresponds to the last dimension
of X, while the initial element of LJDIR corresponds to the first
dimension of X.
The explicit meaning of "forward" transform -- the coefficients of
exp(+i * 2*pi*kl/N) -- is:
result for j=1,...,n
result(j)=the sum from k=1,...,n of
x(k)*exp(-i*(j-1)*(k-1)*2*pi/n)
where i=sqrt(-1)
Note that the result is unnormalized. Applying the "backward"
transform to the result of a "forward" transform returns N times
the original vector of length N. Equivalently, applying either
the "forward" or "backward" transform four times in succession
yields N^2 times the original vector of length N.
Performing the transform requires some WORKSPACE, which can be
set up beforehand by calling fft_setup, if fft is to be called
more than once with arrays X of the same shape. If no setup
keyword argument is supplied, the workspace allocation and setup
must be repeated for each call.
unknown type function, documented at startup/fft.i line 93
| |
| SEE ALSO: |
roll, |
|
|
fft_braw
|
fft_braw, n, c, wsave
Swarztrauber's cfftb. You can use this to avoid the additional
2*N storage incurred by fft_setup.
unknown type function, documented at startup/fft.i line 245
| |
|
fft_fraw
|
fft_fraw, n, c, wsave
Swarztrauber's cfftf. You can use this to avoid the additional
2*N storage incurred by fft_setup.
unknown type function, documented at startup/fft.i line 236
| |
|
fft_init
|
fft_init, n, wsave
Swarztrauber's cffti. This actually requires wsave=array(0.0, 4*n+15),
instead of the 6*n+15 doubles of storage used by fft_raw to handle the
possibility of multidimensional arrays. If the storage matters, you
can call cfftf and/or cfftb as the Yorick functions fft_fraw and/or
fft_braw.
unknown type function, documented at startup/fft.i line 227
| |
|
fft_inplace
|
fft_inplace, x, direction
or fft_inplace, x, ljdir, rjdir
or fft_inplace, x, ljdir, rjdir, setup=workspace
is the same as the fft function, except that the transform is
performed "in_place" on the array X, which must be of type complex.
unknown type function, documented at startup/fft.i line 104
| |
| SEE ALSO: |
fft, |
|
|
fft_setup
|
workspace= fft_setup(dimsof(x))
or workspace= fft_setup(dimsof(x), direction)
or workspace= fft_setup(dimsof(x), ljdir, rjdir)
allocates and sets up the workspace for a subsequent call to
fft(X, DIRECTION, setup=WORKSPACE)
or
fft(X, LJDIR, RJDIR, setup=WORKSPACE)
The DIRECTION or LJDIR, RJDIR arguments compute WORKSPACE only for
the dimensions which will actually be transformed. If only the
dimsof(x) argument is supplied, then WORKSPACE will be enough to
transform any or all dimensions of X. With DIRECTION or LJDIR, RJDIR
supplied, WORKSPACE will only be enough to compute the dimensions
which are actually to be transformed. The WORKSPACE does not
depend on the sign of any element in the DIRECTION (or LJDIR, RJDIR),
so you can use the same WORKSPACE for both "forward" and "backward"
transforms.
Furthermore, as long as the length of any dimensions of the array
X to be transformed are present in WORKSPACE, it may be used in
a call to fft with the array. Thus, if X were a 25-by-64 array,
and Y were a 64-vector, the following sequence is legal:
ws= fft_setup(dimsof(x));
xf= fft(x, 1, setup=ws);
yf= fft(y, -1, setup=ws);
The WORKSPACE required for a dimension of length N is 6*N+15 doubles.
unknown type function, documented at startup/fft.i line 176
| |
| SEE ALSO: |
fft, |
|
|
find_boundary
|
boundary= find_boundary(mesh)
or boundary= find_boundary(mesh, region, sense)
returns an array of 4 pointers representing the boundary of the
MESH, or of a particular REGION of the MESH, with a particular
SENSE -- 0 for counterclockwise in the (r,z)-plane, 1 for
clockwise. The returned arrays are:
*boundary(1) zone index list -- always 1-origin values
*boundary(2) side list 0, 1, 2, or 3
side 0 is from point zone to zone-1, side 1 is
from zone-1 to zone-imax-1
*boundary(3) z values of boundary points
*boundary(4) r values of boundary points
unknown type function, documented at startup/drat.i line 1110
| |
| SEE ALSO: |
form_mesh, |
|
|
fitlsq
|
yp= fitlsq(y, x, xp)
...
yfit= interp(yp, xp, xfit)
performs a least squares fit to the data points (X, Y). The input
XP are the abcissas of the piecewise linear function passing through
(XP, YP) which is the best fit to the data (X,Y) in a least squares
sense. The XP must be strictly monotone, either increasing or
decreasing. As for interp, the piecewise linear fit is taken to be
constant outside the limits of the XP.
The result YP is linearly interpolated through any consecutive
intervals of XP which contain no data points X, and linearly
extrapolated beyond the extreme values of X (if any of the intervals
of XP lie outside these extremes).
A WEIGHT keyword of the same length as X and Y may be supplied in
order to weight the various data points differently; a typical
WEIGHT function is 1/sigma^2 where sigma are the standard deviations
associated with the Y values.
unknown type function, documented at include/fitlsq.i line 35
| |
| SEE ALSO: |
interp |
|
|
fitpol
|
yp= fitpol(y, x, xp)
-or- yp= fitpol(y, x, xp, keep=1)
is an interpolation routine similar to interp, except that fitpol
returns the polynomial of degree numberof(X)-1 which passes through
the given points (X,Y), evaluated at the requested points XP.
The X must either increase or decrease monotonically.
If the KEEP keyword is present and non-zero, the external variable
yperr will contain a list of error estimates for the returned values
yp on exit.
The algorithm is taken from Numerical Recipes (Press, et. al.,
Cambridge University Press, 1988); it is called Neville's algorithm.
The rational function interpolator fitrat is better for "typical"
functions. The Yorick implementaion requires numberof(X)*numberof(XP)
temporary arrays, so the X and Y arrays should be reasonably small.
unknown type function, documented at include/fitrat.i line 37
| |
| SEE ALSO: |
fitrat, |
|
|
fitrat
|
yp= fitrat(y, x, xp)
-or- yp= fitrat(y, x, xp, keep=1)
is an interpolation routine similar to interp, except that fitpol
returns the diagonal rational function of degree numberof(X)-1 which
passes through the given points (X,Y), evaluated at the requested
points XP. (The numerator and denominator polynomials have equal
degree, or the denominator has one larger degree.)
The X must either increase or decrease monotonically. Also, this
algorithm works by recursion, fitting successively to consecutive
pairs of points, then consecutive triples, and so forth.
If there is a pole in any of these fits to subsets, the algorithm
fails even though the rational function for the final fit is non-
singular. In particular, if any of the Y values is zero, the
algorithm fails, and you should be very wary of lists for which
Y changes sign. Note that if numberof(X) is even, the rational
function is Y-translation invariant, while numberof(X) odd generally
results in a non-translatable fit (because it decays to y=0).
If the KEEP keyword is present and non-zero, the external variable
yperr will contain a list of error estimates for the returned values
yp on exit.
The algorithm is taken from Numerical Recipes (Press, et. al.,
Cambridge University Press, 1988); it is called the Bulirsch-Stoer
algorithm. The Yorick implementaion requires numberof(X)*numberof(XP)
temporary arrays, so the X and Y arrays should be reasonably small.
unknown type function, documented at include/fitrat.i line 109
| |
| SEE ALSO: |
fitpol, |
|
|
fitsAddComment
|
fitsAddComment, header, string
Add STRING as a comment in HEADER (a FitsHeader structure). If
STRING is too long, it is broken in pieces.
unknown type function, documented at include/fits.i line 106
| |
| SEE ALSO: |
fitsRead, |
|
|
fitsAddHistory
|
fitsAddHistory, header, string
Add STRING as an history card in HEADER (a FitsHeader structure).
If STRING is too long, it is broken in pieces.
Keyword STAMP may be used with a zero value to avoid the
additional time stamp (default is to add a time stamp).
unknown type function, documented at include/fits.i line 124
| |
| SEE ALSO: |
fitsRead, |
|
|
fitsFixHeader
|
fitsFixHeader, header
check consistency of FITS header.
unknown type function, documented at include/fits.i line 89
| |
| SEE ALSO: |
fitsRead, |
|
|
fitsHeader
|
header= fitsHeader();
fitsHeader, header;
creates a structure FitsHeader with defaults. Equivalent to:
header= FitsHeader(bscale= 1., bzero= 0.);
unknown type function, documented at include/fits.i line 74
| |
| SEE ALSO: |
fitsRead, |
|
|
fitsRead
|
a= fitsRead(filename, header)
returns the data of the FITS file FILENAME. If present, the
optional argument HEADER will be used to store the contents of
the FITS header file (a FitsHeader structure).
Keyword WHICH may be used to indicate which sub-array should be
returned. For instance, if the array DATA with dimensions
(235,453,7) is stored in the FITS file "data.fits", the sub-array
DATA(,,4) can be read by:
SUB_DATA= fitsRead("data.fits", which= 4);
Keyword PACK, if non-nil and non-zero, indicates that axis whith
unit dimension should be ignored. The default is to ignore only
zero length axis.
Keyword RESCALE, if non-nil and zero, indicates that read data
values should not be rescaled according to FITS keywords
BSCALE and BZERO. The default is to rescale data values if
BSCALE is not 1. or BZERO is not 0.
unknown type function, documented at include/fits.i line 441
| |
| SEE ALSO: |
fitsWrite, |
|
|
fitsRescale
|
rescaled_data= fitsRescale(data, bitpix, bscale, bzero)
Linearly rescale the values of input array DATA to fit into
integers with BITPIX bits per value (i.e., `char', `short' or
`long' for BITPIX being 8, 16 and 32 respectively).
Arguments BSCALE and BZERO are optional and purely outputs passed
by address. Their value will be set so that:
DATA(i) = BZERO + BSCALE * RESCALED_DATA(i)
where the equality may not be exact due to rounding errors. The
difference is however the smallest possible, i.e., less than
BSCALE / 2.
Keywords DATA_MIN and DATA_MAX may be used to supply the maximum
and minimum data values or to set brightness cutoffs.
unknown type function, documented at include/fits.i line 170
| |
| SEE ALSO: |
fitsRead, |
|
|
fitsWrite
|
fitsWrite, filename, data, header
Write DATA in file FILENAME using FITS format. If present, the
information of the optional argument HEADER (a FitsHeader structure)
will be used to write the FITS file header.
Keyword PACK, if non-nil and non-zero, indicates that axis whith
unit dimension should be ignored. The default is to ignore only
zero length axis.
Keyword RESCALE, if non-nil and zero, indicates that input data
values should not be rescaled into integers according to FITS
standard. The default, is to recode doubles as 32 bit integers,
floats as 16 bit integers and integers into smallest integers
possible without loss of dynamic range (e.g., an array of long
integers ranging from -31 to +130 will be recoded as chars).
unknown type function, documented at include/fits.i line 223
| |
| SEE ALSO: |
fitsRead, fitsAddComment |
|
|
floor
|
floor(x)
returns the largest integer not greater than x (no-op on integers).
unknown type function, documented at startup/std.i line 625
| |
| SEE ALSO: |
ceil |
|
|
fma
|
fma
frame advance the current graphics window. The current picture
remains displayed in the associated X window until the next element
is actually plotted.
unknown type function, documented at startup/graph.i line 198
| |
| SEE ALSO: |
window, |
|
|
form_mesh
|
form_mesh(zsym, khold, lhold)
returns an opaque "mesh" object, which will hold rt, zt, ireg,
and a boundary edge list. This opaque mesh object is required
as an input to the integ_flat and integ_linear routines.
ZSYM is 2 for spherical symmetry, 1 for z=0 reflection symmetry,
or 0 for no symmetry
KHOLD and LHOLD are the 1-origin indices of "hold" lines in the
mesh, or 0 if none. This information is used only during the
pcen_source operation before integ_linear is called.
unknown type function, documented at startup/drat.i line 1085
| |
| SEE ALSO: |
update_mesh, |
|
|
form_rays
|
best= form_rays( [x, y, z, theta, phi] )
or dirt= form_rays( [x, y, theta] )
or internal= form_rays( [cos, sin, y, z, x, r] )
forms 5-by-nrays, 3-by-nrays, or 6-by-nrays ray representation
given individual lists of array coordinates. The [...]
operator builds an nrays-by-5, nrays-by-3, or nrays-by-6
array, which form_rays transposes. The "nrays" may represent
zero or more actual dimensions.
unknown type function, documented at include/rays.i line 39
| |
| SEE ALSO: |
best_rays, picture_rays |
|
|
|
|
|
|
|
|
|