• d1mach
  • dbint4
  • dbintk
  • dbvalu
  • defc
  • dgefs
  • dp1vlu
  • dpcoef
  • dpolft
  • vSort
  • vSum
  • r1mach
  • rand
  • regFft
  • regFftw
  • regElementMult
  • regWrapAround
  • xsetf
  • tcl_slatec.c

    Bindings for SLATEC
    

    d1mach

    TCL SYNTAX:
      d1mach  "<i>" 
    
    TCL HELP STRING:
      Return floating point machine dependent constants -- double precision (double)
    
       Assume double precision numbers are represented in the T-digit,
       base-B form
    
                  sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
    
       where 0 .LE. X(I) .LT. B for I=1,...,T, 0 .LT. X(1), and
       EMIN .LE. E .LE. EMAX.
    
       The values of B, T, EMIN and EMAX are provided in I1MACH as
    
    	i returns
    	1 B**(EMIN-1), the smallest positive magnitude.
    	2 B**EMAX*(1 - B**(-T)), the largest magnitude.
    	3 B**(-T), the smallest relative spacing.
    	4 B**(1-T), the largest relative spacing.
    	5 LOG10(B)
    Returns the value requested by the input paramter
    
    TCL ARGUMENTS:
                     : 
      "<i>"        : input parameter
    
    

    dbint4

    TCL SYNTAX:
      dbint4  "<x>" "<y>" "-ibcl" "-ibcr" "-fbcl" "-fbcr" "-kntopt" "<t>" "<w>" 
    
    TCL HELP STRING:
          dbint computes the B representation (T,BCOEF,N,K) of a
        cubic spline (K=4) which interpolates data (X(I)),Y(I))),
        I=1,NDATA.
    Returns a FUNC of type bspline.
    
    TCL ARGUMENTS:
                     : 
      "<x>"        : vector of abcissae of length ndata, distinct and in increasing order
      "<y>"        : vector of ordinates length ndata.
      "-ibcl"        : selection parameter for left boundary condition; 1 constrains first derivative to fbcl; 2 constrains second derivative to fbcl
      "-ibcr"        : selection parameter for right boundary condition; 1 constrains first derivative to fbcl; 2 constrains second derivative to fbcl
      "-fbcl"        : left boundary value governed by ibcl
      "-fbcr"        : right boundary value governed by ibcl
      "-kntopt"      : knot selection parameter; 1 sets knot multiplicity at t[3] and t[n] to 4; 2 sets a symmetric placement of knots about t[3] and t[n]; 3 sets knots based on w set by user
      "<t>"        : knot array of length ndata+6
      "<w>"        : work array of at length at least 5*(ndata+2); if kntopt=3 then w[0] w[1] w[2] are knot values to the left of x[0]; w[3] w[4] w[5] are to the right, in increasing order supplied by the user.
    
    

    dbintk

    TCL SYNTAX:
      dbintk  "<x>" "<y>" "-k" 
    
    TCL HELP STRING:
          dbint computes the B representation (T,BCOEF,N,K) of a
        spline which interpolates data (X(I)),Y(I))),
        I=1,NDATA.
    Returns a FUNC of type bspline.
    
    TCL ARGUMENTS:
                     : 
      "<x>"        : vector of abcissae of length n, distinct
      "<y>"        : vector of ordinates length n
      "-k"           : order of the spline (k=4 is cubic)
    
    

    dbvalu

    TCL SYNTAX:
      dbvalu  "<t>" "<a>" "<k>" "<ideriv>" "<x>" "-inbv" "<work>" 
    
    TCL HELP STRING:
               DBVALU evaluates the B-representation (T,A,N,K) of a B-spline
             at X for the function value on IDERIV=0 or any of its
             derivatives on IDERIV=1,2,...,K-1.  Right limiting values
             (right derivatives) are returned except at the right end
             point X=T[N] where left limiting values are computed.  The
             spline is defined on T[K] .LE. X .LE. T[N].  DBVALU returns
             a fatal error message when X is outside of this interval.
    
             To compute left derivatives or left limiting values at a
             knot T[I], replace N by I-1 and set X=T[I], I=K,N.
    
    Keyed list of dbvalue (the value of the spline evaluated at x) and inbv, which must be entered as input for efficient processing after the initial call.  Distinct splines require distinct inbv parameters.
    
    TCL ARGUMENTS:
                     : 
      "<t>"        : knot array of length n+4
      "<a>"        : B-spline coefficient vector of length n
      "<k>"        : order of the B-spline, k >= 1
      "<ideriv>"   : order of the derivative 0 <= ideriv <= k-1.
      "<x>"        : argument, t[k-1] <= x <= t[n]
      "-inbv"        : initialization that must be set to 1 the first time DBVALU is called.  Its return value is used as input on subsequent calls with the same spline for efficient processing.
      "<work>"     : work vector of length 3*k
    
    

    defc

    TCL SYNTAX:
      defc  "<x>" "<y>" "<sd>" "<nord>" "<bkpt>" 
    
    TCL HELP STRING:
        Fit a piecewise polynomial curve to discrete data.
      The piecewise polynomials are represented as B-splines.
      The fitting is done in a weighted least squares sense.
      A FUNC of the type bspline
    
    TCL ARGUMENTS:
                     : 
      "<x>"        : vector of abcissae
      "<y>"        : vector of ordinates
      "<sd>"       : y standard deviation.  0 in any entry will weight that data point as 1.
      "<nord>"     : order of the spline,  4 for cubic spline.  Keep it between (1 .le. nord .le. 20) please.
      "<bkpt>"     : Break points
    
    

    dgefs

    TCL SYNTAX:
      dgefs  "<a>" "<lda>" "<n>" "<v>" "<itask>" "<work>" "<iwork>" 
    
    TCL HELP STRING:
      Subroutine DGEFS solves a general NxN system of double
    precision linear equations using LINPACK subroutines DGECO
    and DGESL.  That is, if A is an NxN double precision matrix
    and if X and B are double precision N-vectors, then DGEFS
    solves the equation
                            A*X=B.
    The matrix A is first factored into upper and lower tri-
    angular matrices U and L using partial pivoting.  These
    factors and the pivoting information are used to find the
    solution vector X.  An approximate condition number is
    calculated to provide a rough estimate of the number of
    digits of accuracy in the computed solution.
    If the equation A*X=B is to be solved for more than one vector
    B, the factoring of A does not need to be performed again and
    the option to only solve (ITASK.GT.1) will be faster for
    the succeeding solutions.  In this case, the contents of A,
    LDA, N and IWORK must not have been altered by the user follow-
    ing factorization (ITASK=1).  IND will not be changed by DGEFS
    in this case.
    
    ind, a rough estimate of the number of digits of accuracy in the solution x,
    or an error code if ind < 0.
    
    TCL ARGUMENTS:
                     : 
      "<a>"        : on entry, the elements of a 2-d array of dimension n,lda (c-convention) which contains the coefficient matrix.  On return, an upper triangular matrix U ant the multipliers mecessary to construct a matrix L so that A*L=V
      "<lda>"      : the leading dimension of the array A
      "<n>"        : the order of the matrix A.  The first n elements are the elements of the first column.
      "<v>"        : on entry, the singly subscripted vector of dimension n containing the right hand side B of A*X=B.  On return, v contains the solution vector x.
      "<itask>"    : 1 factor A and solve; >1 solve using existing a and iwork
      "<work>"     : work space of at least dimension n
      "<iwork>"    : work space of at least dimension n
    
    

    dp1vlu

    TCL SYNTAX:
      dp1vlu  "<l>" "<nder>" "<x>" "<yp>" "<func>" 
    
    TCL HELP STRING:
      The subroutine  DP1VLU  uses the coefficients generated by  DPOLFT
    to evaluate the polynomial fit of degree  L , along with the first
    NDER  of its derivatives, at a specified point.  Computationally
    stable recurrence relations are used to perform this task.
    
    The value of the fitting polynomial of degree l at x.  Also fills in yp.
    
    TCL ARGUMENTS:
                     : 
      "<l>"        : degree of the polynomial to be evaluated, less than or equal to ndeg provided by dpolft
      "<nder>"     : number of derivatives to be calculated
      "<x>"        : location to evaluate the polynomial and its derivatives
      "<yp>"       : vector to be filled with nder derivatives
      "<func>"     : FUNC from dpolft
    
    

    dpcoef

    TCL SYNTAX:
      dpcoef  "<func>" "<l>" "-c" 
    
    TCL HELP STRING:
      Return the taylor expansion of the results of dpolft around point c
    
    TCL ARGUMENTS:
                     : 
      "<func>"     : The FUNC to evaluate
      "<l>"        : Degree of the Taylor expansion
      "-c"           : Center of the Taylor expansion
    
    

    dpolft

    TCL SYNTAX:
      dpolft  "<x>" "<y>" "<w>" "<maxdeg>" "-eps" 
    
    TCL HELP STRING:
      Given a collection of points X(I) and a set of values Y(I) which
    correspond to some function or measurement at each of the X(I),
    subroutine  DPOLFT  computes the weighted least-squares polynomial
    fits of all degrees up to some degree either specified by the user
    or determined by the routine.  The fits thus obtained are in
    orthogonal polynomial form.  Subroutine  DP1VLU  may then be
    called to evaluate the fitted polynomials and any of their
    derivatives at any point.  The subroutine  DPCOEF  may be used to
    express the polynomial fits as powers of (X-C) for any specified
    point C.
    Returns a keyed list of ndeg (degree of the highest degree fit computed), eps (RMS error of the polynomial of degree ndeg), ierr (1 is normal), and r (vector containit the values of the fit of degree nfit at each x
    
    TCL ARGUMENTS:
                     : 
      "<x>"        : vector of abcissae
      "<y>"        : vector of ordinates
      "<w>"        : vector of weights.  If w[0] is negative, all weights will be set to 1.0
      "<maxdeg>"   : maximum degree allowed for polynomial fit.
      "-eps"         : if negative, use statistical F test to determine degree; if 0, compute all polynomials up to maxdeg; if positive, tolerence on RMS error
    
    

    vSort

    TCL SYNTAX:
      vSort  "<vIn>" "<kFlag>" 
    
    TCL HELP STRING:
      	Return the permutation vector vPerm generated by sorting
    	the vector vIn, and, optionally, rearrange the values in
    	vIN.  Uses SLATEC subrouting dpsort
    	The vector vPerm
    
    TCL ARGUMENTS:
                     : 
      "<vIn>"      : The vector to be sorted
      "<kFlag>"    : 2=increasing and sort vIn; 1=increasing and do not sort vIN; -1=decreasing and do not sort vIn; -2=decreasing and sort vIn
    
    

    vSum

    TCL SYNTAX:
      vSum  "<vIn>" "[vMask]" 
    
    TCL HELP STRING:
      	Sum the values of the vector, using mask if it is there
    	The vector vPerm
    
    TCL ARGUMENTS:
                     : 
      "<vIn>"      : The vector to be summed
      "[vMask]"      : The mask vector
    
    

    r1mach

    TCL SYNTAX:
      r1mach  "<i>" 
    
    TCL HELP STRING:
      Return floating point machine dependent constants -- single precision (float)
    
       Assume single precision numbers are represented in the T-digit,
       base-B form
    
                  sign (B**E)*( (X(1)/B) + ... + (X(T)/B**T) )
    
       where 0 .LE. X(I) .LT. B for I=1,...,T, 0 .LT. X(1), and
       EMIN .LE. E .LE. EMAX.
    
       The values of B, T, EMIN and EMAX are provided in I1MACH as
    
    	i returns
    	1 B**(EMIN-1), the smallest positive magnitude.
    	2 B**EMAX*(1 - B**(-T)), the largest magnitude.
    	3 B**(-T), the smallest relative spacing.
    	4 B**(1-T), the largest relative spacing.
    	5 LOG10(B)
    Returns the value requested by the input paramter
    
    TCL ARGUMENTS:
                     : 
      "<i>"        : input parameter
    
    

    rand

    TCL SYNTAX:
      rand  "[seed]" 
    
    TCL HELP STRING:
            This pseudo-random number generator is portable among a wide
    variety of computers.  RAND undoubtedly is not as good as many
    readily available installation dependent versions, and so this
    routine is not recommended for widespread usage.  Its redeeming
    feature is that the exact same random numbers (to within final round-
    off error) can be generated from machine to machine.  Thus, programs
    that make use of random numbers can be easily transported to and
    checked in a new environment.
                Input Argument --
           If seed = 0., the next random number of the sequence is generated.
           If seed < 0., the last generated number will be returned for
             possible use in a restart procedure.
           If seed > 0., the sequence of random numbers will start with
             the seed mod 1.  This seed is also returned as the value of
             RAND provided the arithmetic is done exactly.
    Returns a  pseudo-random number between 0. and 1.
    
    TCL ARGUMENTS:
                     : 
      "[seed]"       : input parameter
    
    

    regFft

    TCL SYNTAX:
      regFft  "<rReg>" "<iReg>" "<direction>" 
    
    TCL HELP STRING:
      	replace the region with its fourier transform (or inverse fourier
    	transform)
    	error if the region is not FL32, is not square, or if direction
    	is not +1 or -1
    
    TCL ARGUMENTS:
                     : 
      "<rReg>"     : Real part of region to transform
      "<iReg>"     : Imaginary part of region to transform
      "<direction>" : +1 for fourier transform; 0 for inverse
    
    

    regFftw

    TCL SYNTAX:
      regFftw  "<rReg>" "<iReg>" "<direction>" 
    
    TCL HELP STRING:
      	replace the region with its fourier transform (or inverse fourier
    	transform) using the FFTW algorithms.
    	error if the region is not FL32, is not square, or if direction
    	is not +1 or -1
    
    TCL ARGUMENTS:
                     : 
      "<rReg>"     : Real part of region to transform
      "<iReg>"     : Imaginary part of region to transform
      "<direction>" : +1 for fourier transform; 0 for inverse
    
    

    regElementMult

    TCL SYNTAX:
      regElementMult  "<rReg1>" "<iReg1>" "<rReg2>" "<iReg2>" 
    
    TCL HELP STRING:
      	replace reg1 with an element-by-element multiplication of reg1*reg2
    	for FL32 regions only
    	error if regions are not the same size or of type FL32
    
    TCL ARGUMENTS:
                     : 
      "<rReg1>"    : real part of first region 
      "<iReg1>"    : imag part of first region 
      "<rReg2>"    : real part of second region 
      "<iReg2>"    : imag part of second region 
    
    

    regWrapAround

    TCL SYNTAX:
      regWrapAround  "<reg>" "<norm>" 
    
    TCL HELP STRING:
      Shuffle around the values in the region to put them in wrap around
    form so Press et al. can work their magic.  Do this to a region
    which contains the PSF centered before FFT convolution.
    
    SH_SUCCESS or SH_GENERIC_ERROR if nrow, ncol are not multiples
    of two or if it is not of type FL32
    
    
    TCL ARGUMENTS:
                     : 
      "<reg>"      : region to wrap around
      "<norm>"     : normalization  (nrow*ncol)/flux
    
    

    xsetf

    TCL SYNTAX:
      xsetf  "<kontrl>" 
    
    TCL HELP STRING:
      XSETF sets the error control flag value to KONTRL.
    (KONTRL is an input parameter only.)
    The following table shows how each message is treated,
    depending on the values of KONTRL and LEVEL.  (See XERMSG
    for description of LEVEL.)
    
    If KONTRL is zero or negative, no information other than the
    message itself (including numeric values, if any) will be
    printed.  If KONTRL is positive, introductory messages,
    trace-backs, etc., will be printed in addition to the message.
    
          ABS(KONTRL)
            LEVEL        0              1              2
            value
              2        fatal          fatal          fatal
    
              1     not printed      printed         fatal
    
              0     not printed      printed        printed
    
             -1     not printed      printed        printed
                                      only           only
                                      once           once
    The input parameter.
    
    TCL ARGUMENTS:
                     : 
      "<kontrl>"   : input parameter