Next Previous Contents

10. numerics.ct

This section describes functions from file numerics.ct.

10.1 accum

[u] = accum(...)
 [u] = accum(i,j,...,v)
   is the same as u[i,j,...]+= v
   except that repeated indices are handled by sequential
   increments rather than the last assignment only being effective
   as in u[i,j,...]+= v.
   Error codes:
   -30: Too few input args to accum (min is 2)
   -1: I/O arg u (left-hand-side) is non-numeric
   -2: I/O arg u is scalar but last input arg is not
   -3: I/O arg u is scalar but one of the indices is not 1, : or #(1)
   -4: Mismatch between rank of I/O arg u and number of indices
   -5: Scalar index out of range
   -6: Invalid IntArray used as index, should be one-dimensional
   -7: Vector index out of range
   -8: Invalid index, should be integer or IntArray
   -9: Accumulating non-integer into integer array
   -10: Accumulating non-real into real array
   -11: Accumulating non-scalar into complex array
   -12: Too large dimensional accum, not yet implemented (internal error)
   -14: Type mismatch
   -22: Index vector length disagrees with 'RHS' length

10.2 applyfilter

[U] = applyfilter(u,c,d)
 U = applyfilter(u,c,d)
   applies a IIR (Infinite Impulse Response) digital filter
   to time series real vector u, producing another vector U.
   The filter coefficients c,d must be real vectors.
   The filter formulas is
     U[n] = c**u[n-k] + d**U[n-j]
   where k=0:length(c)-1, j=1:length(d)
   and starts effects are handled by repeating the first
   component backwards.
   Error codes:
   -1: First input arg must be real vector
   -2: Second input arg must be real vector
   -3: Third input arg must be real vector

10.3 bsearch

[i] = bsearch(x,X)
 i = bsearch(x,X)
   binary-searches for value X in ordered vector x and returns index i
   such that x[i] <= X <= x[i+1] if x is monotonically increasing,
   or x[i] >= X >= x[i+1] if x is monotonically decreasing.
   The first argument x must be monotonic int or real vector,
   and second argument X can be either int or real scalar or array.
   The result value i is integer-valued, and of the same size as X.
   It satisfies 1<=i<=N-1 where N=length(x) in cases where X is
   in the range min(x[1],x[N])..max(x[1],x[N]), and zero otherwise
   (point out of range).
   The execution time of bsearch is O(log(length(x))*length(X)).
See also: <@@ref>interpinterp.
   Error codes:
   -1: First arg not int or real vector
   -2: Second arg not int or real

10.4 intpol

[y] = intpol(A...)
 intpol(A,index1,index2...) is a general interpolation
   function. A must be an array from which values are interpolated.
   The rank of A must equal the number of index arguments.
   Each index argument may be a real scalar or real array.
   All index arguments must mutually agree in type and rank.
   The array A may also be complex. The result y is of same
   rank and size as each of the index arguments.

   intpol(A,i,j,...) is a generalization of mapped indexing
   A<[i,j,...]> for non-integral indices. The function benefits
   from vectorization even more than most other Tela functions.

   Currently intpol uses linear interpolation.
   Error codes:
   -1: First arg not a numerical array
   -2: Rank of first arg does not match number of index args
   -3: Non-real index arg
   -4: Dissimilar index args
   -6: Range overflow

10.5 stencil2d_4

[Lu] = stencil2d_4(u,ap0,am0,a0p,a0m)
 stencil2d_4(u,ap0,am0,a0p,a0m) computes the two-dimensional
   five-point "molecule" where the coefficient of the central
   term is unity:

   Lu = u[i,j]
      + ap0*u[i+1,j] + am0*u[i-1,j]
          + a0p*u[i,j+1] + a0m*u[i,j-1];

   where the indices i and j run from 2..nx and 2..ny where
   [nx,ny] = size(u). The size of ap0,am0,a0p,a0m must be two
   less than the size of u in both directions.
   Error codes:
   -1: One of the arguments is not a real matrix
   -2: One of the coefficient args has bad size


Next Previous Contents