1 INTRODUCTION

Contents of this section

Negative error codes describe fatal errors, whereas positive error codes are warnings only. In case of fatal error, the function output arguments have undefined values. If a function has no output arguments, it typically has only positive return codes.

The error code descriptions do normally not appear in the Tela help messages. If an error occurs, Tela will however find and display the proper textual message.

1.1 BatchMode

[y] = BatchMode()
 BatchMode() returns 1 if this Tela process is in batch mode
   (command line switch -b), otherwise 0.
See also:
SilentMode , VerboseMode .

1.2 FFT

[f] = FFT(u; dim)
 FFT(u) gives the complex Fast Fourier Transform of u.
   If u's rank is more than one, the transform is computed
   only along the first dimension (many independent 1D
   transforms).

   FFT(u,dim) computes the FFT along the specified dimension.
   The first dimension is labeled 1 and so on.

   The forward FFT is defined as

   FFT(u)_j = sum(c_k * exp(-i*(j-1)*(k-1)*2*pi/n), k=1..n)

   where i = sqrt(-1).
   
See also:
invFFT .
   Error codes:
   -1: First argument not a numeric array
   -2: Second argument not integer
   -3: Second argument out of range
   

1.3 HeavisideTheta

[y] = HeavisideTheta(x)
 y = HeavisideTheta(x) returns 1 if x>=0 and 0 if x<0.
   x must be real. If x is array, the operation is applied componentwise.
See also:
sign .
   Error codes:
   -1: Complex or nonnumeric input argument 

1.4 Im

[y] = Im(x)
 y = Im(x) computes the imaginary part of a complex quantity x.
   If x is real or integer, the result is zero.
   If x is an array, the operation is applied componentwise.
See also:
Re , conj , arg .
   Error codes:
   -1: Nonnumeric input argument 

1.5 LU

[L;U,P] = LU(A)
 [L,U,P] = LU(A) computes the LU factorization of matrix A.
   The factorization is A = P**L**U, where P is a permutation
   matrix, L is lower triangular with unit diagonal and U is
   upper triangular.
   [LU] = LU(A) leaves the factors L and U packed in one matrix.
   [LU,P] = LU(A) returns also the permutation matrix P.
See also:
inv , linsolve , SVD .
   Error codes:
   1: Singular matrix (==> zero in U's diagonal)
   -1: Input arg not an array
   -2: Input arg not a rank-2 array (matrix)
   

1.6 Re

[y] = Re(x)
 y = Re(x) computes the real part of a complex quantity x.
   If x is real or integer, it is returned as such.
   If x is an array, the operation is applied componentwise.
See also:
Im , conj , arg .
   Error codes:
   -1: Nonnumeric input argument 

1.7 SVD

[U;S,V] = SVD(A)
 [U,S,V] = SVD(A) computes the singular value
   decomposition of matrix A: A = U**S**V'.
   U and V are unitary and S is diagonal.
   SVD(A) as such returns the vector of singular values.
See also:
LU .
   Error codes:
   1: No convergence
   -1: Input arg not an array
   -2: Input array is not a matrix
   -3: Internal error
   -4: Two output arg case not supported (must be 1 or 3)
   

1.8 SilentMode

[y] = SilentMode()
 SilentMode() returns 1 if this Tela process is in silent mode
   (command line switch -s), otherwise 0.
See also:
BatchMode , VerboseMode .

1.9 VerboseMode

[y] = VerboseMode(;x)
 VerboseMode() returns 1 if this Tela process is in verbose mode
   (command line switch -v), otherwise 0.
   VerboseMode(on) and VerboseMode(off) set the verbose mode on
   and off, respectively. They return the old mode setting.
See also:
SilentMode , BatchMode .
   Error codes:
   1: Argument not integer 

1.10 abs2

[y] = abs2(x)
 y = abs2(x) computes the square of the absolute value of x.
   If x is real or integer, the result is just the square of x.
   If x is complex, the result is equal to x*conj(x).
   If x is an array, the operation is applied componentwise.
   Error codes:
   -1: Nonnumeric input argument 

1.11 acos

[y] = acos(x)
 y = acos(x) computes the arc cosine of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.

1.12 all

[y] = all(x)
 all(x) returns 1 if all elements of x are nonzero,
   and 0 otherwise.
   x must be an integer array or scalar.
See also:
any .
   Error codes:
   1: Argument not integer or IntArray 

1.13 annotate

[] = annotate(primitive...)
 annotate("primitive"[,options]) adds MTV annotations to the previous
   graph. The plot command(s) and the annotate command(s) must appear
   inside hold(on) ... hold(off) in order to work correctly.
See also:
plotopt , hold , plot , pcolor , mesh , contour , vplot .
   Error codes:
   1: Could not open temporary MTV file
   2: First argument not a string
   3: Syntax error in graph options 

1.14 any

[y] = any(x)
 any(x) returns 1 if at least one element of x is nonzero,
   and 0 otherwise.
   x must be a integer array or scalar.
See also:
all .
   Error codes:
   1: Argument not integer or IntArray 

1.15 arg

[phi] = arg(z)
 arg(z) returns the argument of a complex quantity
   (in radians). The result is between -pi and pi.
   If z is a complex array, the operation is applied
   componentwise.
See also:
Re , Im , conj .
   Error codes:
   1: Nonnumeric argument 

1.16 asin

[y] = asin(x)
 y = asin(x) computes the arc sine of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.

1.17 atan

[y] = atan(x)
 y = atan(x) computes the arc tangent of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.
See also:
atan2 .

1.18 atan2

[z] = atan2(y,x)
 z = atan2(y,x) computes the arcus tangent of y/x using the signs
   of both arguments to determine the quadrant of the return value.
   The input argument must be integer or real scalars and the
   return value is real.
See also:
atan .
   Error codes:
   -1: Bad input argument 

1.19 autosource

[] = autosource(fn...)
 autosource("file.t","name1","name2",...) tags symbols
   name1, name2,... such that the command source("file.t")
   is effectively executed when any of the symbols name
   is used. This is load-on-demand.
See also:
source .
   Error codes:
   1: Argument not a string 

1.20 cd

[] = cd(fn)
 cd("pathname") will change the current directory to "pathname".
   Error codes:
   1: Input argument not a string or a char
   2: Directory not found 

1.21 ceil

[y] = ceil(x)
 ceil(x) returns the smallest integer which is larger than x.
   x must be integer or real scalar or array. If it is an array,
   the operation is applied componentwise.
See also:
floor .
   Error codes:
   -1: Complex or nonnumeric input argument 

1.22 conj

[y] = conj(x)
 y = conj(x) computes the complex conjugate of x.
   Real and integer arguments are returned as such.
   If x is an array, the operation is applied componentwise.
See also:
Re , Im , arg .

1.23 contour

[] = contour(z...)
 contour(z[,options]) plots the matrix z as a filled contour plot.
See also:
contour3 , annotate , plot , mesh , pcolor , vplot .
   Error codes:
   1: Could not open temporary MTV file
   2: First argument is not a numeric 2D array
   3: Syntax error in graph options
   4: Write error in MTV file - file system full? 

1.24 contour3

[] = contour3(z...)
 contour3(z[,options]) plots the 3D array as a
   "volume" plot. Currently this only means that all
   six faces of the volume are contoured and colored
   according to options.
See also:
annotate , plot , mesh , pcolor , vplot .
   contour.
   Error codes:
   1: Could not open temporary MTV file
   2: First argument is not a real 3D array
   3: Syntax error in graph options
   4: Write error in MTV file - file system full? 

1.25 cos

[y] = cos(x)
 y = cos(x) computes the cosine function of x.
   If x is complex, the result is complex, otherwise real.
   The argument must be in radians.
   If x is an array, the operation is applied componentwise.

1.26 cosh

[y] = cosh(x)
 y = cosh(x) computes the hyperbolic cosine function of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.

1.27 cot

[y] = cot(x)
 y = cot(x) is the cotangent function
   cot(x) = 1/tan(x) = cos(x)/sin(x). 

1.28 cputime

[t] = cputime()
 cputime() returns the CPU time in seconds used by the current
   tela session.
See also:
tic , toc .

1.29 csc

[y] = csc(x)
 y = csc(x) is the cosecant function
   csc(x) = 1/sin(x). 

1.30 det

[d] = det(A)
 det(A) returns the determinant of a square matrix A.
   A may be integer, real or complex valued.
   If A is scalar, it is returned as such.
   Error codes:
   -1: Nonnumeric input arg
   -2: Input array is not a matrix
   -3: Input matrix is not square
   -4: Singular matrix 

1.31 diag

[y] = diag(x)
 diag(V) (V is a vector) returns a square diagonal matrix,
   whose diagonal elements are given by V.
   diag(M) (M is a matrix) returns the main diagonal of M
   as a vector.
   Error codes:
   -1: Input array not vector or matrix
   

1.32 disasm

[] = disasm(fn)
 disasm(f) produces disassembly listing of function f.
   Error codes:
   1: Argument not a Tela function 

1.33 dump

[] = dump()
 dump() dumps the stack. Useful for debugging only. 

1.34 echo

[] = echo(x)
 echo(on) and echo(off) set the echo mode on and off.
   The mode is off by default. When echo mode is on, the source
   code is echoed as it is parsed.

   *** NOTE: Currently this function has no effect! ***

   Error codes:
   1: Input argument not an integer 

1.35 eig

[D;V] = eig(A)
 eig(A) returns the eigenvalues of a square matrix A.
   [D,V] = eig(A) returns the eigenvalues in D and the
   right eigenvectors as columns of V. The eigenvectors
   satisfy A**V == D*V.
See also:
inv , LU .
   Error codes:
   1: Failed to converge
   -1: Input arg is not an array
   -2: Input array is not a matrix
   -3: Input matrix is not square
   -4: Internal error
   

1.36 eval

[] = eval(s)
 eval("string") executes string as a Tela command, as it had been
   typed from the keyboard.
   The evaluation is done in global context. The symbols appearing
   in the string refer to the global ones.
See also:
evalexpr .
   Error codes:
   1: Argument not a string or char 

1.37 evalexpr

[y] = evalexpr(s)
 evalexpr("expression") executes string as a Tela command,
   returning its value in y.
   The evaluation is done in global context. The symbols appearing
   in the string refer to the global ones.
See also:
eval .
   Error codes:
   1: Argument not a string or char 

1.38 exit

[] = exit()
 exit() stops Tela. quit() is synonym for exit(). 

1.39 exp

[y] = exp(x)
 y = exp(x) computes the exponent function of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.

1.40 export_matlab

[] = export_matlab(fn...)
 export_matlab("file") saves all variables in Tela
   workspace in "file". Any previous contents of "file"
   is overwritten. The data are written in MATLAB
   binary format.
   export_matlab("file","var1","var2"...) saves only the specified variables.
   Notice that you have to give the variable names as strings.

   The resulting MAT-file can be read using the
   MATLAB 'load' command.
   
   Limitations (bugs): It is not possible to export
   local variables. If you try, the global ones will
   be written, if they have numeric values.
   
See also:
save , load , import .
   Error codes:
   1: Too few arguments
   2: Argument not a string or char
   3: Write error on file
   

1.41 eye

[A] = eye(n)
 eye(n) returns the (integer) unit matrix of order n.
   n must be a non-negative scalar integer.
   eye(V) where V is a two-element integer vector with
   both elements equal and positive works also, thus
   you can also use eye(size(A)).
See also:
ones , inv .
   Error codes:
   -1: Argument not an integer or IntArray
   -2: Negative dimension
   -3: IntArray rank not 1
   -4: IntArray length not 2
   -5: Integer vector elements are unequal
   

1.42 find

[y] = find(x)
 I=find(V) returns the index vector I=(i) for which
   V[i] is nonzero. V must be an integer array. The length
   of I is equal to the number of nonzeros in V.
   If V is multidimensional, it is used in flattened form.
See also:
any , all , flatten .
   Error codes:
   1: Argument not integer vector 

1.43 flatten

[y] = flatten(;x)
 flatten(x) returns the array x flattened to a vector.
   If x is not an array, it is returned as is.
   x = flatten() flattens x "in place". This is much faster
   (it works in constant time) than to do x = flatten(x),
   since no data movement is involved. 

1.44 floor

[y] = floor(x)
 floor(x) returns the largest integer which is smaller than x.
   x must be integer or real scalar or array. If it is an array,
   the operation is applied componentwise.
See also:
ceil .
   Error codes:
   -1: Complex or nonnumeric input argument 

1.45 format

[] = format(str...)
 format("format-string",arg1,arg2,...) prints "format-string"
   to standard output, replacing occurrences of `format-spec`
   with consecutive args. `Format-spec` is either empty, i.e. ``,
   or of the form

       `[-]w[.d]`.

   Here w is the field width (unsigned integer) and d is the number
   of significant digits, also unsigned integer. By default the
   argument is printed left-justified, but the optional minus sign
   dictates right justification. The backquote character `  can be
   produced by writing it three times: ```.
   
   Hint: You can add any number of spaces before the closing backquote,
   for example `20.7    `.
   These spaces do not affect the output. This feature can be used
   to justify source code lines.
See also:
sformat .
   Error codes:
   1: First argument not a string or char 

1.46 getenv

[y] = getenv(varname)
 getenv("envvar") returns the value of environment variable
   "envvar", or VOID if such variable is not defined in
   the UNIX environment.
   Error codes:
   -1: Argument not a string or char
   

1.47 grid

[X,Y] = grid(x,y)
 [X,Y] = grid(x,y) produces matrices X,Y that are formed from vectors x,y
   such that X[i,j] = x[i] for all j, and Y[i,j] = y[j] for all j.
   Error codes:
   -1: Input argument is array but not a vector
   -2: Input argument is not real array 

1.48 help

[] = help(;fn)
 help(function-name) or help("help-item") displays the help information
   associated with a given function or a given help item. On command line
   you may use the abbreviation

      ?help-item
   or
      help help-item

   These forms are translated to help("help-item") before parsing.

   First tries:
   help operators
   help special
   help if
   help for
   help function
   ...
   
   Error codes:
   1: Item not found
   2: Cannot open help file 

1.49 herm

[B] = herm(A; P)
 herm(A) is the same as conj(transpose(A)).
   herm(A,P) is the same as conj(transpose(A,P)).
   You can abbreviate "herm(A)" as "A'".
See also:
transpose .
   Error codes:
   -1: Permutation argument not integer array
   -2: Permutation argument of bad rank or size
   -3: Permutation argument contains invalid integers 

1.50 hold

[] = hold(flag)
 hold(on) and hold(off) set the graphics hold mode on and off.
   When hold is on, all graphics commands will be accumulated and
   performed only until hold(off).
   If hold(on) is called many times in succession, also hold(off)
   must be called as many times until the plots are produced.
   For example, if

   function f() {hold(on); plot1(); plot2(); hold(off)};

   and it is called as

   hold(on); f(); plot3(); hold(off);

   then all three plots are actually combined in one plot.
See also:
plot .
   Error codes:
   1: Argument not an integer 

1.51 import

[] = import(filename)
 import("file") tries to load the contents of "file"
   into Tela workspace. All files accepted by load are
   also accepted by import. In addition import accepts
   more general HDF files and MATLAB binary files.
   Create these files using the MATLAB 'save' command.

   Restrictions:
   1) Only MATLAB files created on a similar
   architecture can be correctly imported. If this rule
   is not followed, the imported data will be garbage!
   2) MATLAB4.0 and higher saves arrays with more than
   10000 elements as various integer formats, if all
   elements are whole numbers. Tela cannot read these
   files. A workaround is to perturb one element in
   MATLAB before saving so that it is not exactly
   integer.

   For filename conventions, see load.
See also:
load , save , import1 , export_matlab .

   (The difference between import and import1 is that
    import1 reads only one object and returns it, whereas
    import reads several objects and assigns them directly
    to workspace variables.)
   Error codes:
   1: Argument not string or char
   2: Argument is not an HDF file
   3: File not found
   4: Cannot import file
   5: Unused error message
   6: Cannot import this Matlab file (O(letter'Oh) != 0, (can even Matlab?))
   7: Cannot import this Matlab file (P != 0). Is your array size >10000 and all integer? Try perturbing it
   8: Cannot import this Matlab file (T != 0, 1). Is it a sparse matrix? Make it full
   10: Bad Matlab binary file, premature end of file
   

1.52 import1

[x] = import1(filename; label)
 import1("file") reads one object from "file".
   The imported object is returned.
   The "file" can be an HDF file, in which
   case the first Scientific Data Set (SDS) is
   loaded.

   import1("file.hdf","label") reads SDS with
   label "label", which is not necessarily the
   first one.

   The "file" can also be an ASCII file
   of the following format:
   
   (line 1)   D=Nt dim1 dim2 ... dimN
   (line 2)   data1 data2 ....

   where N is the rank of the dataset and t is an
   optionial type specification letter: t may be either
   'r', 'i', or 'c' for real, integer and complex data,
   respectively. If t is missing, real data are asssumed.
See also:
import , load , save .
   See 'help import' for a difference between import
   and import1.
   For filename conventions, see load.
   Error codes:
   -1: Input arg not a char or string
   -2: File not found
   -3: Unknown format in ASCII file
   -4: Unknown format in ASCII file
   -5: Too high rank ASCII data
   -6: Syntax error in ASCII file dimension specification
   -7: Syntax error when reading ASCII data
   -8: Internal error
   -9: Cannot import file
   -10: Second arg not a string
   -11: Specified label not found
   

1.53 info

[] = info()
 info() shows information about various class sizes for this Tela implementation.
   It also prints the total counts of Tnode, Tprg and Tobject objects at the moment. 

1.54 input_string

[s] = input_string()
 input_string() waits for an input line from the keyboard
   and returns it as a string. The newline is not included
   in the result.
   If the string is enclosed in double quotes, they are removed.
   Error codes:
   -1: EOF encountered. 

1.55 inv

[B] = inv(A)
 inv(A) returns the inverse of a square matrix A.
   A may be integer, real or complex valued.
   A may also be a scalar, in which case its reciprocal
   is returned.
See also:
linsolve , LU , matprod , det , eig .
   Error codes:
   -1: Nonnumeric input arg
   -2: Input array is not a matrix
   -3: Input matrix is not square
   -4: Singular matrix
   -5: Singular matrix 

1.56 invFFT

[f] = invFFT(u; dim)
 invFFT() is the inverse of FFT():

   invFFT(u)_j = (1/n) * sum(c_k * exp(i*(j-1)*(k-1)*2*pi/n), k=1..n)

   Differences to FFT: sign of i is plus, scale factor 1/n.
   
See also:
FFT .
   Error codes:
   -1: First argument not a numeric array
   -2: Second argument not integer
   -3: Second argument out of range
   

1.57 isCfunction

[y] = isCfunction(x)
 isCfunction(x) returns 1 if x is a C-tela function.
   and 0 otherwise.
See also:
isfunction , isTfunction .

1.58 isTfunction

[y] = isTfunction(x)
 isTfunction(x) returns 1 if x is a function written in Tela
   and 0 otherwise.
See also:
isfunction , isCfunction .

1.59 isarray

[y] = isarray(x)
 isarray(x) returns 1 if x is an array and 0 if it is not.
See also:
isscalar , isvector , ismatrix .

1.60 ischar

[y] = ischar(x)
 ischar(x) returns 1 if x is a character and 0 otherwise.
See also:
isstring , isstr .

1.61 iscomplex

[y] = iscomplex(x)
 iscomplex(x) returns 1 if x is a complex array or scalar,
   and 0 if it is real or integer or a nonnumeric object.
See also:
isreal , isfloat , isint .

1.62 isdefined

[y] = isdefined(x)
 isdefined(x) returns 1 if x is not undefined and 0 if
   it is undefined. Optional function arguments are undefined
   if not assigned by the caller; isdefined can be used
   inside the function to test whether this is the case.
See also:
isundefined .

1.63 isfinite

[y] = isfinite(x)
 isfinite(x) returns 1 if x is a finite number and 0 otherwise.
   If x is array, the operation is applied componentwise.
   If x is non-numeric it is considered not finite.
   Integer and consequently strings and chars are always finite. 

1.64 isfloat

[y] = isfloat(x)
 isfloat(x) returns 1 if x is a floating point array
   or scalar, and 0 otherwise. Notice the difference between
   isfloat and isreal. isreal(x) is 1 for integer objects,
   while isfloat(x) is 0.
See also:
isreal , isint , iscomplex .

1.65 isfunction

[y] = isfunction(x)
 isfunction(x) returns 1 if x is a function
   (Tela-function, C-tela function or intrinsic function)
   and 0 otherwise.
See also:
isCfunction , isTfunction .

1.66 isint

[y] = isint(x)
 isint(x) returns 1 if x is integer scalar or array
   and 0 if it is not.
See also:
isreal , isfloat , iscomplex .

1.67 ismatrix

[y] = ismatrix(x)
 ismatrix(x) returns 1 if x is a matrix (2D array)
   and 0 if it is not.
See also:
isscalar , isvector , isarray .

1.68 isreal

[y] = isreal(x)
 isreal(x) returns 1 if x is numerical non-complex
   array or scalar, and 0 otherwise.
See also:
isfloat , isint , iscomplex .

1.69 isscalar

[y] = isscalar(x)
 isscalar(x) returns 1 if x is scalar and 0 if it is not.
See also:
isvector , ismatrix , isarray .

1.70 isstr

[y] = isstr(x)
 isstr(x) returns 1 if x is a character or string
   and 0 otherwise.
See also:
isstring , ischar .
   NOTICE: Usually you want to use isstr, not isstring. 

1.71 isstring

[y] = isstring(x)
 isstring(x) returns 1 if x is a string and 0 otherwise.
See also:
ischar , isstr .
   NOTICE: Usually you want to use isstr, not isstring. 

1.72 isundefined

[y] = isundefined(x)
 isundefined(x) returns 1 if x is not undefined and 0 if
   it is undefined. Optional function arguments are undefined
   if not assigned by the caller; isdefined can be used
   inside the function to test whether this is the case.
See also:
isdefined .

1.73 isvector

[y] = isvector(x)
 isvector(x) returns 1 if x is a vector and 0 if it is not.
See also:
isscalar , ismatrix , isarray .

1.74 isvoid

[y] = isvoid(x)
 isvoid(x) returns 1 if x is a void value and 0 otherwise. 

1.75 length

[L] = length(x)
 length(x) returns the total number of elements in array x.
   If x is scalar, length(x) is 1.
See also:
size , rank .

1.76 link

[] = link(filename)
 link("file.o") makes C-tela functions in "file.o" available
   to Tela. "file.o" must be compiled from a C-tela file
   (usually "file.ct").
   Error codes:
   1: Cannot initialize DLD
   2: Cannot link-load file
   3: Argument not string or char
   4: Cannot find fninfo pointer
   5: Internal inconsistency
   6: Undefined symbols remain
   7: main function returned error code
   8: Could not dlclose the previous linkage
   9: Too many dynamically linked modules
   10: File not found
   

1.77 linsolve

[x] = linsolve(A,b)
 linsolve(A,b) solves the linear system A**x == b.
   If A is square, the result x is roughly the same as
   computing inv(A)**b (however, using linsolve is
   faster and numerically more accurate). If x is not
   square, a least-square problem is solved. If the system
   is overdetermined, the solution x minimizes the quantity
   |A**x - b|. If the system is underdetermined, the
   solution x minimizes |x| among all x that satisfy
   A**x==b.
See also:
inv , LU , eig , SVD .
   Error codes:
   -1: First input arg is not an array
   -2: First input arg is not a matrix
   -3: Second input arg is not an array
   -4: Second input arg is not a vector or matrix
   -5: Incompatible dimensions in first/second args
   -6: Matrix must be square
   -7: Singular matrix
   -8: Internal error
   

1.78 load

[] = load(filename)
 load("file") loads the contents of "file"
   in Tela workspace.
   "file" must have been previously created using
   the 'save' command; it must be in a certain
   HDF format.

   Filename conventions:
   If the filename starts with "/", "./" or "..",
   it is considered absolute. Otherwise it is searched
   along TELAPATH. This applies to other file
   operations as well.
   
   The counterpart of load is save.
   To read more general HDF files and ASCII files,
   see import1.
   To load more general HDF files and MATLAB binary
   files, see import.
See also:
save , import , import1 , export_matlab .
   Error codes:
   1: Argument not string or char
   2: Argument is not an HDF file
   3: File not found
   

1.79 log

[y] = log(x)
 y = log(x) computes the natural logarithm of x.
   If x is complex, the result is complex. If x is real or
   integer, but negative, the result is complex (purely
   imaginary). If x is real or integer and non-negative,
   the result is real.
   If x is an array, the operation is applied componentwise.
   If some of the components are negative, all components
   of the result are complex. 

1.80 matprod

[C] = matprod(A,B; Aflag,Bflag)
 matprod(A,B) returns the matrix product of A and B.
   If at least one of A and B is scalar, matprod(A,B) is the
   same as their ordinary product A*B. If both A and B
   are arrays, their "inner" dimensions must agree.
   That is, the last dimension of A must equal the first
   dimension of B.
   You can abbreviate matprod(A,B) as A**B.

   Optional args: matprod(A,B,aflag,bflag) can be used to
   transpose or Hermitian-conjugate the factors before the
   product. 'n' means no operation, 't' means transpose and
   'h' means Hermitian conjugate. For example,

   matprod(A,B,'h') = A'**B = herm(A)**B
   matprod(A,B,'n','t') = A**B.' = A**transpose(B)

   Normally you need not use matprod explicitly, but you
   can use the operator **, which is internally translated
   to matprod. Hermitian conjugates and transposes in
   connection with ** produce the corresponding 'h' and
   't' options in matprod. For example,

   A'**B        generates       matprod(A,B,'h')
   A.'**B'      generates       matprod(A,B,'t','h')
   A**B.'       generates       matprod(A,B,'n','t')

   and so on. The runtime is optimal for all these operations.
See also:
inv .
   
   Error codes:
   -1: Inner dimensions do not agree
   -2: Resulting array would have too high rank
   -3: Third arg not one of 'n', 't', 'h'
   -4: Fourth arg not one of 'n', 't', 'h'
   

1.81 menu

[result] = menu(title...)
 choice = menu("title","choice1","choice2",...) displays
   a menu of choices and returns the number entered by
   the user.
See also:
smenu .
   Error codes:
   -1: Less than two input args 

1.82 mesh

[] = mesh(z...)
 mesh(z[,options]) plots the matrix z as a 3D mesh.
See also:
annotate , plot , contour , pcolor , vplot .
   Error codes:
   1: Could not open temporary MTV file
   2: First argument is not a numeric 2D array
   3: Syntax error in graph options
   4: Write error in MTV file - file system full? 

1.83 ones

[y] = ones(...)
 ones(n,m...) returns an integer array with all elements
   equal to 1 of size n x m x ... .

   ones(V) where V is an integer vector, and thus
   ones(size(A)) work also.
See also:
rand , eye .
   
   Error codes:
   -1: Input argument not an integer or IntVector
   -2: Rank of requested tensor array exceeds MAXRANK
   -3: Non-positive input argument
   -4: Negative input argument
   -5: Integer array rank not 1
   

1.84 pause

[] = pause()
 pause() will wait for a keypress on keyboard. 

1.85 pcolor

[] = pcolor(z...)
 pcolor(z[,options]) plots the matrix z as a pseudocolor density plot.
See also:
annotate , plot , contour , mesh , vplot .
   Error codes:
   1: Could not open temporary MTV file
   2: First argument is not a numeric 2D array
   3: Syntax error in graph options
   4: Write error in MTV file - file system full? 

1.86 plot

[] = plot(...)
 plot(x1,y1,[options1], x2,y2,[options2],...) is the basic 2D plot function.
   Each vector yi is plotted versus the corresponding xi. All curves yi are
   displayed in the same figure. The option sequences must consist of keyword-
   value pairs. Example:

       x = 0:0.1:4*pi;
       plot(x,sin(x), "linewidth",3,"linecolor",2);

   The abscissa x may be missing, in which case the default of 1:length(y)
   is used. The ordinates y may be matrices; then each row produces one
   curve. If also abscissa x is matrix, the x-value may be different for each
   curve.
See also:
plot3 , annotate , plotopt , mesh , contour , pcolor , vplot .
   Error codes:
   1: Could not open temporary MTV file
   2: Nonnumeric or complex data argument
   3: Syntax error in graph options
   4: The abscissa ("x") must be a vector or a matrix
   5: The ordinate ("y") must be a vector or a matrix
   6: x and y dimensions disagree
   

1.87 plot3

[] = plot3(x,y,z...)
 plot3(x,y,z[,options]) produces parametric space curves.
   The quantities x,y,z must have equal ranks, and they can
   be either vectors or matrices. If they are vectors, only
   one space curve is drawn. If they are matrices, the number
   of curves produces equals the number of rows.
See also:
plot , annotate .
   Error codes:
   1: Could not open temporary MTV file
   2: y dimensionality disagrees with x dimensionality
   3: z dimensionality disagrees with x dimensionality
   4: Input arrays must be integer or real arrays
   5: Input arrays must have rank equal to 1 or 2
   6: Syntax error in graph options
   

1.88 plotopt

[] = plotopt(s)
 plotopt("-3d -colorps -landscape...") sets a set of PlotMTV command
   line options for subsequent graphics commands.
See also:
plot , annotate .
   Error codes:
   1: Argument not a string 

1.89 prod

[y] = prod(x)
 y = prod(x) multiplies all the elements of x, is x is an array.
   If x is scalar, it is returned as such.
See also:
sum .
   Error codes:
   -1: Nonnumeric input arg 

1.90 quit

[] = quit()
 quit() stops Tela. quit() is synonym for exit(). 

1.91 rand

[x] = rand(...)
 rand() returns a random real x, 0<=x<1.
   rand(N) (N positive integer) returns a real random vector of length N.
   rand(N,M) returns a random matrix, and so on.
   Error codes:
   -1: Tried to create too high rank array
   -2: Argument not an integer
   -3: Non-positive integer argument 

1.92 rank

[y] = rank(x)
 rank(A) returns the number of dimensions of array A.
   The rank of a scalar is 0.
See also:
length , size .

1.93 reshape

[B] = reshape(A...)
 reshape(A,n,m,...) returns the data in array A rearranged
   to have dimensionality n x m x ... . The product of the indices
   must equal the length of A.
   reshape(A,#(n,m...)) works also.
   Error codes:
   -1: First argument not an array
   -2: Later argument not an integer
   -3: Product of dimensions does not equal the length of first argument
   -4: Number of input arguments exceeds MAXRANK
   -5: Second arg is array but not integer vector
   

1.94 round

[y] = round(x)
 round(x) returns the nearest integer.
   x must be integer or real scalar or array. If it is an array,
   the operation is applied componentwise.
See also:
floor , ceil .
   Error codes:
   -1: Complex or nonnumeric input argument 

1.95 save

[] = save(fn...)
 save("file") saves all variables in Tela workspace
   in "file". Any previous contents of "file" is
   overwritten. The data are written as Scientific
   Data Sets in HDF format.
   save("file","var1","var2"...) saves only the
   specified variables. Notice that you have to give
   the variable names as strings.

   Limitations (bugs): It is not possible to save
   local variables, since they are not bound to
   symbols. If you try, the global one, if any,
   will be saved.
   
See also:
load , export_matlab .
   Error codes:
   1: Too few arguments
   2: Argument not a string or char
   3: Unexpected HDF error
   

1.96 sec

[y] = sec(x)
 y = sec(x) is the secant function
   sec(x) = 1/cos(x). 

1.97 sformat

[s] = sformat(formatstr...)
 sformat("format-string",arg1,arg2,...) is similar to format,
   except that it does not output to stdout but returns a string
   variable.
See also:
format .
   Error codes:
   -1: First argument not a string or char 

1.98 showcompiled

[] = showcompiled(filename...)
 showcompiled("filename.ct",f1,f2,...) compiles functions
   f1,f2,... to C-tela code, creating "filename.ct".
   If no suffix is given in "filename", the suffix
   ".ct" will be assumed.
   showcompiled(f1,f2,...) displays on standard output.
See also:
t2ct .
   NOTE: STILL UNDER DEVELOPMENT
   Error codes:
   1: One of the args is not a Tela-function
   2: Cannot open output file
   

1.99 sign

[y] = sign(x)
 y = sign(x) returns 1 if x>0, 0 if x==0, and -1 if x<0.
   x must be real. If x is array, the operation is applied componentwise.
See also:
HeavisideTheta .
   Error codes:
   -1: Complex or nonnumeric input argument 

1.100 sin

[y] = sin(x)
 y = sin(x) computes the sine function of x.
   If x is complex, the result is complex, otherwise real.
   The argument must be in radians.
   If x is an array, the operation is applied componentwise.

1.101 sinh

[y] = sinh(x)
 y = sinh(x) computes the hyperbolic sine function of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.

1.102 size

[...] = size(x)
 [n,m,...] = size(A) finds out the dimensions of array A.
   The number of n,m... must not exceed rank(A). If rank(A)==0
   (that is, A is scalar), n=size(A) sets 1 to n.
   V = size(A) assigns the dimension vector [n,m,..] to V.
   If A is scalar, V is set to 1, if A is vector, V becomes
   a one-element vector.
See also:
length , rank .
   Error codes:
   -1: No output arguments
   1: More than one output arg but non-array input arg
   2: Too many output args relative to input arg rank 

1.103 smenu

[result] = smenu(title...)
 choice = smenu("title","choice1","choice2",...) displays
   a menu of choices and returns the "choice" string corresponding
   to the number entered by the user.
See also:
menu .
   Error codes:
   -1: Less than two input args 

1.104 sort

[y] = sort(;x)
 sort(x) returns array x sorted in ascending order.
   If x is not an array, it is returned as is.
   x = sort() sorts x in place.
   x may not be complex.
   Error codes:
   1: Complex input arg 

1.105 source

[] = source(fn)
 source("file.t") loads the tela code from given file.
See also:
autosource , load .
   Error codes:
   1: Operation did not succeed
   2: Argument not a string 

1.106 sqrt

[y] = sqrt(x)
 y = sqrt(x) computes the square root of x.
   If x is complex, the result is complex. If x is real or
   integer, but negative, the result is complex (purely
   imaginary). If x is real or integer and non-negative,
   the result is real.
   If x is an array, the operation is applied componentwise.
   If some of the components are negative, all components
   of the result are complex.

1.107 str2num

[y] = str2num(s)
 str2num(s) converts a string to a number.
   The string must represent a scalar. If an error
   occurs, str2num returns a void value.
   Error codes:
   1: Argument not a string or char 

1.108 streq

[y] = streq(s1,s2)
 streq("string1","string2") returns 1 if the argument
   strings are exactly equal and 0 otherwise. If one of
   the args is not a string, the result is also 0.
See also:
strstarteq .

1.109 strstarteq

[y] = strstarteq(s1,s2)
 strstarteq("string1","string2") returns 1 if the argument
   strings are equal on the first min(length(s1),length(s2))
   characters and 0 otherwise.
   If one of the the args is not a string, the result is also 0.
See also:
streq .

1.110 sum

[y] = sum(x)
 y = sum(x) sums all the elements of x, is x is an array.
   If x is scalar, it is returned as such.
See also:
prod .
   Error codes:
   -1: Nonnumeric input arg 

1.111 system

[] = system(s)
 system("string") executes string as an external operating system
   (Unix) command.
   Error codes:
   1: Argument not a string or char 

1.112 t2ct

[] = t2ct(fn)
 t2ct("filename.t") translates t-code to ct-code.
   Error codes:
   1: Operation did not succeed
   2: Argument not a string
   3: Could not open output file
   

1.113 tan

[y] = tan(x)
 y = tan(x) computes the tangent function of x.
   If x is complex, the result is complex, otherwise real.
   The argument must be in radians.
   If x is an array, the operation is applied componentwise.

1.114 tanh

[y] = tanh(x)
 y = tanh(x) computes the hyperbolic tangent function of x.
   If x is complex, the result is complex, otherwise real.
   If x is an array, the operation is applied componentwise.

1.115 tic

[] = tic()
 tic() marks the CPU time at which it was invoked.
   To measure CPU time, use tic() and toc().
See also:
cputime , toc .
   Example:

      a = rand(100,100); tic(); b=inv(a); toc()

  This would measure the CPU time in inverting a 100x100
  random real matrix. See also: toc. 

1.116 toc

[t] = toc()
 toc() gives the CPU seconds used since the last call to tic().
See also:
tic , cputime .

1.117 tostring

[y] = tostring(x)
 tostring(x) converts an integer vector to a string.
   Error codes:
   -1: Argument not an integer vector
   

1.118 transpose

[B] = transpose(A; P)
 B = transpose(A) returns a transpose of array A: B[i,j,k...l] = A[l...k,j,i].
   B = transpose(A,P) where P is integer vector transposes the indices in the
   permutation defined by P.
   For example if A has rank 3, B = transpose(A,[2,1,3]) causes the assignment
   B[j,i,k] = A[i,j,k] to be carried out. B = transpose(A) would in this case
   correspond to B[k,j,i] = A[i,j,k].

   You can abbreviate "transpose(A)" by "A.'".
See also:
herm .
   Error codes:
   -1: Permutation argument not integer array
   -2: Permutation argument of bad rank or size
   -3: Permutation argument contains invalid integers 

1.119 verbose

[] = verbose(x)
 THE FUNCTION 'verbose' IS OBSOLETE. USE 'VerboseMode' INSTEAD.
   Error codes:
   1: Input argument not an integer 

1.120 vplot

[] = vplot(x,y,vx,vy...)
 vplot(x,y,vx,vy[,options]) produces a 2D vector plot of the vector
   field (vx,vy). All arguments x,y,vx and vy must be 2D integer or
   real arrays and of the same size. Each 2D vector will be positioned
   at (x[i,j],y[i,j]) and its direction will be (vx[i,j],vy[i,j]) where
   (i,j) run over rows and columns of the matrices.
See also:
annotate , plot , mesh , contour , pcolor .
   Error codes:
   1: Could not open temporary MTV file
   2: One of first four args is not a numeric array
   3: One of first four args has rank not equal to 2
   4: Dimensions of first four args disagree
   5: Syntax error in graph options 

1.121 whos

[] = whos()
 whos() displays names of variables together with their
   types. 

Next Chapter, Previous Chapter

Table of contents of this chapter, General table of contents

Top of the document, Beginning of this Chapter