# Ox Function Reference

## Chapter contents:

| A |
acf | acos | aggregatec | aggregater | any
arglist | asin | atan | atan2
| B |
bessel | betafunc | binand | bincomp
binor
| C |
cabs | cdiv | ceil | cerf | cexp
chdir | choleski | clog | cmul | columns
constant | correlation | cos | cosh | countc
countr | csqrt | cumprod | cumsum | cumulate
| D |
date | dawson | decldl | decldlband | declu
decqr | decqrmul | decsvd | deletec | deleteifc
deleteifr | deleter | denschi | densf | densn
denst | determinant | dfft | diag | diagcat
diagonal | diagonalize | diff0 | discretize | double
dropc | dropr | dawson | dayofcalender | dayofweek
| E |
eigen | eigensym | eigensymgen | eprint | erf
exclusion | exit | exp | expint
| F |
fabs | fclose | feof | fflush | fft
floor | fmod | fopen | format | fprint
fprintln | fread | fremove | fscan | fsize
fseek | fuzziness | fwrite
| G |
gammafact | gammafunc | getcwd | getenv
| I |
idiv | imod | insertc | insertr | int
intersection | invert | inverteps | invertgen | invertsym
isarray | isclass | isdotfeq | isdotinf | isdotnan
isdouble | iseq | isfeq | isfile | isfunction
isint | ismatrix | isnan | isstring
| L |
lag0 | limits | loadmat | log | log10
logdet | loggamma | lower
| M |
matrix | max | maxc | maxcindex | meanc
meanr | min | minc | mincindex
| N |
norm | nullspace
| O |
ols2c | ols2r | olsc | olsr | ones
outer | oxfilename | oxrunerror | oxversion | oxwarning
| P |
periodogram | polydiv | polygamma | polymake
polymul | polyroots | pow | print | println
probchi | probf | probn | probt | prodc
prodr
| Q |
quanchi | quanf | quann | quant | quantilec
quantiler
| R |
range | rank | rann | ranseed | ranu
reflect | reshape | reversec | reverser | round
rows
| S |
savemat | scan | selectc | selectifc | selectifr
selectr | selectrc | setbounds | setdiagonal | setlower
setupper | shape | sin | sinh | sizec
sizeof | sizer | sizerc | solveldl | solveldlband
solvelu | solvetoeplitz | sortbyc | sortbyr | sortc
sortcindex | sortr | spline | sprint | sprintbuffer
sqr | sqrt | sscan | standardize | strfind
strfindr | strifind | strifindr | string | strlwr
strupr | submat | sumc | sumr | sumsqrc
sumsqrr | systemcall
| T |
tailchi | tailf | tailn | tailt | tan
tanh | thinc | thinr | time | timer
timespan | timestr | timing | today | toeplitz
trace | trunc | truncf
| U |
unit | unique | unvech | upper
| V |
va_arglist | varc | variance | varr | vec
vech | vecindex | vecr | vecrindex
| Z |
zeros

## Tables:

Formatting types for scanning
Formatting flags for doubles and integers
Formatting types for printing

## acf

    acf(const ma, const ilag);

`ma`
  in: arithmetic type, T `x` n matrix
`ilag`
  in: int, the highest lag

Return value
  Returns a (`ilag`+1) by n matrix with the autocorrelation function of the columns of `ma` up to lag `ilag`. Returns 0 if `ilag` <= 0. If any variance is <= 1e-20, then the corresponding autocorrelations are set to 0.
See also
  `DrawCorrelogram`, `pacf`

## acos

    acos(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the arccosine of `ma`, of double or matrix type.
See also
  `asin`, `atan`, `cos`, `cosh`, `sin`, `sinh`, `tan`, `tanh`

## aggregatec, aggregater

    aggregatec(const ma, const istep);
    aggregater(const ma, const istep);

`ma`
  in: m `x` n matrix A
`istep`
  in: int, size of groups, s

Return value
  The `aggregatec` function returns a ceil(m/s) by `n` where each group of s observations in every column is replaced by the sum. The `aggregater` function returns a `m` by ceil(n/s) where each group of s observations in every row is replaced by the sum.
See also
  `thinc`, `thinr`

## any

    any(const ma);

`ma`
  in: arithmetic type

Return value
  Returns TRUE if any element of `ma` is TRUE, of integer type.
See also
  equality expressions

## arglist

    arglist();

Return value
  Returns an array of strings holding the command line arguments passed to the Ox program. The first entry is always `"Ox"`.
Example
  Running the following program as `oxl prog.ox a 12 c` (the arguments before `prog.ox` are passed to `oxl`, those after to `prog.ox`)

      #include <oxstd.h>

      main()
      {
          decl args = arglist(), s, i, j;

          for (i = 0; i < sizeof(args); ++i)
          {
              sscan(args[i], "%d", &j);
              print("argument ", i, ": ", args[i],
                    " integer value:", j, "\n");
          }
      }

  will produce:

      argument 0: Ox integer value:0
      argument 1: a integer value:0
      argument 2: 12 integer value:12
      argument 3: c integer value:0

## array

    array(const ma);

`ma`
  in: any type

Return value
  Casts the argument to an array, unless it already is an array.

## asin

    asin(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the arcsine of `ma`, of double or matrix type.
See also
  `acos`, `atan`, `cos`, `cosh`, `sin`, `sinh`, `tan`, `tanh`

## atan, atan2

    atan(const ma);
    atan2(const my, const mx);

`ma`
  in: arithmetic type

Return value
  `atan` returns the arctangent of `ma`, of double or matrix type, between -pi/2 and pi/2.

  `atan2` returns the arctangent of `my ./ mx`, between -pi and pi.

See also
  `acos`, `asin`, `cos`, `cosh`, `sin`, `sinh`, `tan`, `tanh`

## bessel

    bessel(const mx, const type, const n01);
    bessel(const mx, const type, const nu);

`mx`
  in: x, arithmetic type
`type`
  in: character, type of Bessel function: `'J'`, `'Y'`, `'I'`, `'K'`, or string: `"IE"`, `"KE"`, for scaled Bessel functions
`n01`
  in: 0 or 1: order of Bessel function
`nu`
  in: double, fractional order of Bessel function

Return value
  Returns an m `x` n matrix, when `mx` is an m `x` n matrix, or a double when `x` is scalar. The following are available: J0(x), Y0(x), J1(x), Y1(x), and the modified Bessel functions I0(x), K0(x), I1(x), K1(x). If the specified order is not 0 or 1, the fractional Bessel functions are computed. The modified Bessel functions are also available in scaled form: e-xIn(x) and ex Kn(x). The accuracy is to about 15 digits.

## betafunc

    betafunc(const mx, const ma, const mb);

`mx`
  in: x, arithmetic type
`ma`
  in: a, arithmetic type
`mb`
  in: b, arithmetic type

Return value
  Returns the incomplete beta integral Bx(a,b). Returns 0 if a <= 0, b <= 0 or x <= 0. The accuracy is to about 10 digits. The return type is derived as follows:
  - m `x` n matrix, when `mx` is an m `x` n matrix, and `ma`,`mb` are scalar;
  - m `x` n matrix, when `mx` is a scalar, and `ma`,`mb` are m `x` n matrices;
  - m `x` n matrix, when `mx` is an m `x` n matrix, and `ma`,`mb` are m `x` n matrices;
  - double, when `mx` and `ma`,`mb` are scalar.
See also
  `gammafunc`, `probf`, `probf`, `tailf`

## binand, bincomp, binor

    binand(const ia, const ib, ...);
    bincomp(const ia);
    binor(const ia, const ib, ...);

`ia`
  in: int
`ib`
  in: int
`...`
  in: optional additional integers

Return value
  `binand` returns the result from and-ing all arguments (the `&` operator in C,C++ ). `binor` returns the result from or-ing all arguments (the `|` operator in C,C++ ). `bincomp` returns the binary (bit-wise) complement of the argument (the `~` operator in C/C++).

## cabs, cdiv, cerf, cexp, clog, cmul, csqrt

    cabs(const ma);
    cdiv(const ma, const mb);
    cerf(const ma);
    cexp(const ma);
    clog(const ma);
    cmul(const ma, const mb);
    csqrt(const ma);

`ma`, `mb`
  in: 2 `x` n matrix (first row is real part, second row imaginary part), or 1 `x` n matrix (real part only)

Return value
  `cabs` returns a 1 `x` n matrix with the absolute value of the vector of complex numbers.

  `cdiv` returns a 2 `x` n matrix with the result of the division of the two vectors of complex numbers. If both `ma` and `mb` have no imaginary part, the return value will be 1 `x` n.

  `cmul` returns a 2 `x` n matrix with the result of the multiplication of the two vectors of complex numbers. If both `ma` and `mb` have no imaginary part, the return value will be 1 `x` n.

  `csqrt` returns a 2 `x` n matrix with the square root of the vector of complex numbers.

  `cerf` returns a 2 `x` n matrix with the complex error function of the vector of complex numbers.

  `cexp` returns a 2 `x` n matrix with the exponential of the vector of complex numbers.

  `clog` returns a 2 `x` n matrix with the logarithm of the vector of complex numbers.

## ceil

    ceil(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the ceiling of each element of `ma`, of double or matrix type. The ceiling is the smallest integer larger than or equal to the argument
See also
  `floor`, `round`, `trunc`

## chdir

    chdir(const s);

`s`
  in: new directory

Return value
  Returns 1 if the directory was changed successfully, 1 otherwise.

  Windows specific: if the string starts with a drive letter followed by a semicolon, the current drive is also changed. For example, use `chdir("c:")` to change to the C drive.

See also
  `getcwd`, `systemcall`

## choleski

    choleski(const ma);

`ma`
  in: symmetric, positive definite m `x` m matrix A

Return value
  Returns the Choleski decomposition P of a symmetric positive definite matrix A: A=PP'; P is lower triangular (has zero's above the diagonal). Returns 0 if the decomposition failed.
See also
  `decldl`, `invertsym`, `solvelu`

## columns

    columns(const ma);

`ma`
  in: any type

Return value
  Returns an integer value with the number of columns in the argument `ma`:
  - m `x` n matrix: n;
  - string: number of characters in the string;
  - array: number of elements in the array;
  - file: number of columns in the file; (only if opened with `f` format, see `fopen`);
  - other: 0.
See also
  `rows`, `sizeof`

## constant

    constant(const dval, const r, const c);
    constant(const dval, const ma);

`dval`
  in: double
`r`
  in: int
`c`
  in: int
`ma`
  in: matrix

Return value
  `constant(dval,r,c)` returns an `r` by `c` matrix filled with `dval`.
  `constant(dval,ma)` returns a matrix of the same dimension as `ma`, filled with `dval`.
See also
  `ones`, `unit`, `zeros`

## correlation

    correlation(const ma);

`ma`
  in: T `x` n matrix A

Return value
  Returns a n `x` n matrix holding the correlation matrix of `ma`. If any variance is <= 1e-20, then the corresponding row and column of the correlation matrix are set to 0.
See also
  `acf`, `meanc`, `meanr`, `standardize`, `varc`, `varr`, `variance`

## cos, cosh

    cos(const ma);
    cosh(const ma);

`ma`
  in: arithmetic type

Return value
  `cos` returns the cosine of `ma`, of double or matrix type. `cosh` returns the cosine hyperbolicus of `ma`, of double or matrix type.
See also
  `acos`, `asin`, `atan`, `cosh`, `sin`, `sinh`, `tan`, `tanh`

## countc

    countc(const ma, const va);

`ma`
  in: m `x` n matrix
`va`
  in: 1 `x` q matrix

Return value
  Returns a matrix `r` which counts of the number of elements in each column of `ma` which is between the corresponding values in `va`:
  `r[0][0]` = # elements in column 0 of `ma` <= `va[0][0]`
  `r[1][0]` = # elements in column 0 of `ma` > `va[0][0]` and <= `va[0][1]`
  `r[2][0]` = # elements in column 0 of `ma` > `va[0][1]` and <= `va[0][2]`
  `r[q][0]` = # elements in column 0 of `ma` > `va[0][q-1]`
  `...`
  `r[0][1]` = # elements in column 1 of `ma` <= `va[0][0]`
  `r[1][1]` = # elements in column 1 of `ma` > `va[0][0]` and <= `va[0][1]`
  `r[2][1]` = # elements in column 1 of `ma` > `va[0][1]` and <= `va[0][2]`
  `r[q][1]` = # elements in column 1 of `ma` > `va[0][q-1]`
  `...`

  If `ma` is m `x` n, and `va` is 1 `x` q the returned matrix is (q+1) `x` n (any remaining columns of `va` are ignored).

See also
  `countr`

## countr

    countr(const ma, const va);

`ma`
  in: m `x` n matrix
`va`
  in: 1 `x` q matrix

Return value
  Returns a matrix `r` which counts of the number of elements in each row of `ma` which is between the corresponding values in `va`:
  `r[0][0]` = # elements in row 0 of `ma` <= `va[0][0]`
  `r[0][1]` = # elements in row 0 of `ma` > `va[0][0]` and <= `va[0][1]`
  `r[0][2]` = # elements in row 0 of `ma` > `va[0][1]` and <= `va[0][2]`
  `r[0][q]` = # elements in row 0 of `ma` > `va[0][q-1]`
  `...`
  `r[1][0]` = # elements in row 1 of `ma` <= `va[0][0]`
  `r[1][1]` = # elements in row 1 of `ma` > `va[0][0]` and <= `va[0][1]`
  `r[1][2]` = # elements in row 1 of `ma` > `va[0][1]` and <= `va[0][2]`
  `r[1][q]` = # elements in row 1 of `ma` > `va[0][q-1]`
  `...`

  If `ma` is m `x` n, and `va` is 1 `x` q the returned matrix is m `x` (q+1) (any remaining columns of `va` are ignored).

See also
  `countc`

## cumprod

    cumprod(const mfac);
    cumprod(const mfac, const cp);
    cumprod(const mfac, const cp, const mz);

`mfac`
  in: T `x` n or 1 `x` n matrix of multiplication factors S
`cp`
  in: int, autoregressive order p (optional argument; default is 1)
`mz`
  in: T `x` n or 1 `x` n matrix of known components Z (optional argument; default is 0)

Return value
  Returns a T `x` n matrix with the cumulated autoregressive product. The first p rows of the return value will be identical to the sum of those in `mz` and `mfac`; the recursion will be applied from the pth term onward. If either `mz` or `mfac` is 1> `x` n, the same values are used for every t.

  `cumprod` computes:

    at = zt + st for t = 0,...,p-1,
    at = zt + st (at-1 `x` ... `x` at-p) for t = p,...,T-1.
See also
  `armagen`, `cumsum` `cumulate`

## cumsum

    cumsum(const mx, const vp);
    cumsum(const mx, const vp, const mstart);

`mx`
  in: T `x` n matrix of known components X
`vp`
  in: 1 `x` p or n `x` p or T `x` p matrix with AR coefficients \phi1, \phi2, ..., \phip
`mstart`
  in: s `x` n matrix of starting values S, s >= p; (optional argument; default is `mx`)

Return value
  Returns a T `x` n matrix with the cumulated autoregressive sum. The first p rows of the return value will be identical to those of `mstart`; the recursion will be applied from the pth term onward.

  If `vp` is 1 `x` p, the same coefficients are applied to each column.

  If `vp` is n `x` p, each row will have coefficients specific to each column of the recursive series.

  Finally, if `vp` is T `x` p, the same coefficients are applied to each column, but the coefficients are specific to each row (time-varying coefficients).

  `cumsum` computes:

    at = st for t = 0,...,p-1,
    at = xt + \phi1 at-1 ... + \phip at-p for t = p,...,T-1.
  When \phi is T by p (and p is not equal to the number of columns in X), the AR coefficients are time-varying:
    at = st for t = 0,...,p-1,
    at = xt + \phit,1 at-1 ... + \phit,p at-p for t = p,...,T-1.
See also
  `armagen`, `cumprod` `cumulate`

## cumulate

    cumulate(const ma);
    cumulate(const ma, const m1, ...);
    cumulate(const ma, const am);

`ma`
  in: T `x` n matrix A
`m1`
  in: n `x` n matrix, coefficients of first lags (optional argument)
`...`
  in: n `x` n matrix, coefficients of lags 2, ...
`am`
  in: array of length k with n `x` n coefficient matrices

Return value
  Returns a T `x` n matrix. The simplest version returns a matrix which holds the cumulated (integrated) columns of `ma`. The second form cumulates (integrates) the (vector) autoregressive process with current values `ma` using the specified coefficient matrices. The function has a variable number of arguments, and the number of arguments determines the autoregressive order (minimum 2 arguments, which is an AR(1) process). Note that `cumulate(m)` corresponds to `cumulate(m, unit( columns(m) ))`.
See also
  `arma0`, `cumsum`, `lag0`

## date

    date();

Return value
  A string holding the current date.
See also
  `time`

## dawson

    dawson(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the Dawson integral of each element of `ma`, of double or matrix type.
See also
  `erf`

## dayofweek, dayofcalender

    dayofweek(const year, const month, const day);
    dayofcalender(const year, const month, const day);

`year`
  in: arithmetic type
`month`
  in: arithmetic type, January=1, etc.
`day`
  in: arithmetic type

Return value
  The `dayofweek` function returns the day of the week (Sunday = 1, Monday = 2, ...). `dayofcalender` returns the day of the calender.
  If all arguments are an integer, the return value will be an integer.
See also
  `timing`

## decldl

    decldl(const ma, const aml, const amd);

`ma`
  in: symmetric, positive definite m `x` m matrix A
`aml`
  in: address of variable
  out: m `x` m lower diagonal matrix L, LDL'=A
`amd`
  in: address of variable
  out: 1 `x` m matrix with reciprocals of D

Return value
  Returns the result of the Choleski decomposition:
  - 1: no error;
  - 0: the Choleski decomposition failed: the matrix is negative definite or the matrix is (numerically) singular.
See also
  `choleski`, `decldlband`, `solveldl`

## decldlband

    decldlband(const ma, const aml, const amd);

`ma`
  in: p `x` m vector specifying the Ab matrix
`aml`
  in: address of variable
  out: holds p `x` m lower diagonal matrix L
`amd`
  in: address of variable
  out: 1 `x` m matrix with reciprocals of D

Return value
  Returns the result of the Choleski decomposition:
  - 1: no error;
  - 0: the Choleski decomposition failed: the matrix is negative definite or the matrix is (numerically) singular.

  For example, if the original matrix has bandwidth p=2, it is stored in `ma` as:

           0      0 [0][2] ... [m-3][m-1]
           0 [0][1] [1][2] ... [m-2][m-1]
      [0][0] [1][1] [2][2] ... [m-1][m-1]

See also
  `diagonal` `solveldlband`, `solvetoeplitz`

## declu

    declu(const ma, const aml, const amu, const amp);

`ma`
  in: square m `x` m matrix A
`aml`
  in: address of variable
  out: m `x` m lower diagonal matrix L, has ones on the diagonal
`amu`
  in: address of variable
  out: m `x` m upper diagonal matrix U, LU=PA
`amp`
  in: address of variable
  out: 2 `x` m matrix, the first row holds the permutation matrix P', A=(LU)[P'][], the second row holds the interchange permutations

Return value
  Returns the result of the LU decomposition:
  - 1: no error;
  - 2: the decomposition could be unreliable;
  - 0: the LU decomposition failed: the matrix is (numerically) singular.
See also
  `determinant`, `invert`, `solvelu`

## decqr

    decqr(const ma, const amht, const amr, const amp);

`ma`
  in: m `x` n matrix A
`amht`
  in: address of variable
  out: n `x` m lower diagonal matrix H', which holds householder vectors
`amr`
  in: address of variable
  out: n `x` n upper diagonal matrix R1
`amp`
  in: address of variable (use 0 as argument to avoid pivoting; note that pivoting is recommended)
  out: 2 `x` n matrix, the first row holds the permutation matrix P', the second row holds the interchange permutations

Return value
  Computes the QR decomposition with pivoting, AP=QR, returning:
  - 0: out of memory,
  - 1: success,
  - 2: ratio of diagonal elements of A'A is large, rescaling is advised,
  - -1: (A'A) is (numerically) singular,
  - -2: combines 2 and -1.
See also
  `decqrmul`, `olsc`, `solvelu`

## decqrmul

    decqrmul(const mht, const my);
    decqrmul(const mht);

`mht`
  in: n `x` m lower diagonal matrix H', which holds householder vectors from previous QR decomposition
`my`
  in: m `x` p matrix Y

Return value
  Returns Q'Y, where Q derives from a previous QR decomposition. To compute QY, use `reversec` to reverse the elements in each column of `mht`.
  The version with one argument returns the m `x` m matrix Q'.
See also
  `decqr`, `olsc`, `solvelu`

## decsvd

    decsvd(const ma);
    decsvd(const ma, const amu, const amw);
    decsvd(const ma, const amu, const amw, const amv);

`ma`
  in: m `x` n matrix A
`amu`
  in: address of variable
  out: m `x` n matrix U, U'U = In
`amw`
  in: address of variable
  out: 1 `x` n matrix with diagonal of W
`amv`
  in: (optional argument) address of variable
  out: if not 0 on input: n `x` n matrix V, UWV'=A, V'V = In

Return value
  The version with one argument: returns a 1 `x` min(m,n) matrix with the singular values, or 0 if the decomposition failed.
  The version with two or more arguments returns an integer indicating the result of the singular value decomposition:
  - 0: no error;
  - k: if the k-th singular value (with index k-1) has not been determined after 50 iterations.

  Note that the singular values are in decreasing order, with the columns of U,V sorted accordingly.

See also multiplicative expressions

## deletec, deleter, deleteifc, deleteifr

    deletec(const ma);
    deletec(const ma, const mval);
    deleter(const ma);
    deleter(const ma, const mval);
    deleteifc(const ma, const mifc);
    deleteifr(const ma, const mifr);

`ma`
  in: m `x` n matrix to delete from
`mval`
  in: p `x` q matrix with values to use for deletion
`mifc`
  in: p `x` n boolean matrix specifying columns to delete
`mifr`
  in: m `x` q boolean matrix specifying rows to delete

Return value
  The `deletec` function with one argument returns an m `x` s matrix, deleting columns from `ma` which have a missing value (NaN: not a number).
  The `deleter` function with one argument returns an s `x` n matrix, deleting rows from `ma` which have a missing value (NaN).
  The remaining forms do not have special treatment of missing values.
  The `deletec` function with two arguments returns an m `x` s matrix, deleting the columns from `ma` which have at least one element equal to an element in the matrix `mval`.
  The `deleter` function with two arguments returns an s `x` n matrix, deleting the rows from `ma` which have at least one element equal to an element in the matrix `mval`.
  The deleteif functions can be used to delete rows or columns based on a logical expression: all rows (columns) wich have a zero in the corresponding row (column) are kept, the remainder is dropped.
  The `deleteifc` function returns an m `x` s matrix, deleting only those columns from `ma` which have at least one non-zero element in the corresponding column of `mifc`.
  The `deleteifr` function returns an s `x` n matrix, deleting only those rows from `ma` which have at least one non-zero element in the corresponding row of `mifr`.
  All functions return an empty matrix if the result is empty.
See also
  `dropc`, `dropr`, `selectc`, `selectr`, `selectrc`, `selectifc`, `selectifr`, `isdotnan`, `vecindex`

## denschi, densf, densn, denst

    denschi(const ma, const df);
    densf(const ma, const df1, const df2);
    densn(const ma);
    denst(const ma, const df);

`ma`
  in: arithmetic type
`df`
  in: arithmetic type, degrees of freedom
`df1`
  in: arithmetic type, degrees of freedom in the numerator
`df2`
  in: arithmetic type, degrees of freedom in the denominator

Return value
  Returns the requested density at `ma` (the returned densities are between positive):
  - `denschi`: chi2(df) density,
  - `densf`: F(df1, df2) density,
  - `densn`: standard normal density,
  - `denst`: student-t(df) density.
  The return type is derived as follows:
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest is scalar;
  - m `x` n matrix, when `ma` is a scalar, and the rest are m `x` n matrices;
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest are m `x` n matrices;
  - double, when `ma` is scalar, and the rest is also scalar.
See also
  `prob...`, `quan...`, `tail...`, Probability package

## determinant

    determinant(const ma);

`ma`
  in: m `x` m matrix

Return value
  Returns the determinant of `ma`. Return type is double.
See also
  `declu`, `invert`, `logdet`

## dfft

    dfft(const ma);
    dfft(const ma, const inverse);

`ma`
  in: 2 `x` n matrix (first row is real part, second row imaginary part), or 1 `x` n matrix (real part only, imaginary part is zero)
`inverse`
  in: (optional argument), int: 1 (do an inverse discrete FT) or 2 (do an inverse real DFT)

Return value
  If only one argument is used, the return value is a 2 `x` s matrix which holds the discrete Fourier transform.

  If `inverse` equals 1, the return value is a 2 `x` s matrix which holds the inverse discrete Fourier transform.

  If `inverse` equals 2, the return value is a 1 `x` s matrix which holds the real inverse discrete Fourier transform.

## diag

    diag(const ma);

`ma`
  in: double, or m `x` 1 or 1 `x` m matrix

Return value
  Returns a m `x` m matrix with `ma` on the diagonal.
See also
  `diagonal`, `diagonalize`, `toeplitz`

## diagcat

    diagcat(const ma, const mb);

`ma`
  in: m `x` n matrix
`mb`
  in: p `x` q matrix

Return value
  Returns an m+p `x` n+q matrix with `mb` concatenated to `ma` along the diagonal; the off-diagonal blocks are set to zero.

## diagonal

    diagonal(const ma);
    diagonal(const ma, const upr);
    diagonal(const ma, const upr, const lwr);

`ma`
  in: arithmetic type
`upr`
  in: (optional argument), int: upper bandwidth (>= 0, default 0)
`lwr`
  in: (optional argument), int: lower bandwidth (<= 0, default 0)

Return value
  The version with one argument returns a matrix with the diagonal from the specified matrix in the first row. Note that the diagonal is returned as a row vector, not a column. If `ma` is m `x` n, the returned matrix is 1 by min(m,n); if `ma` is scalar, the returned matrix is 1 `x` 1.

  The general version returns the banded form, extracting upper diagonals and `lwr` lower diagonals. For example, if `upr`=2 and `lwr`=-1 and the returned matrix is:

           0      0 [0][2] ...
           0 [0][1] [1][2] ...
      [0][0] [1][1] [2][2] ... 	(diagonal)
      [1][0] [2][1] [3][2] ...

See also
  `decldlband`, `diag`, `diagonalize`, `setdiagonal`

## diagonalize

    diagonalize(const ma);

`ma`
  in: arithmetic type

Return value
  Returns a matrix with the diagonal of `ma` on its diagonal, and zeros in off-diagonal elements. If `ma` is m `x` n, the returned matrix is m `x` n; if `ma` is scalar, the returned matrix is 1 `x` 1.
See also
  `diag`, `diagonal`, `setdiagonal`

## diff0

    diff0(const ma, const ilag);
    diff0(const ma, const ilag, const dmisval);

`ma`
  in: T `x` n matrix A
`ilag`
  in: int, lag length of difference (1 for first difference)
`dmisval`
  in: (optional argument) double, value to set missing observations to (default is 0)

Return value
  Returns a T `x` n matrix with the `ilag`th difference of the specified matrix, whereby missing values are replaced by zero. The result has the same dimensions as `ma`.
See also
  `lag0` `diffpow`,

## discretize

    discretize(const vx, const dmin, const dmax, const icount,
        const ioption);

`vx`
  in: 1 `x` T data vector
`dmin`
  in: double, first point a
`dmax`
  in: double, last point b
`icount`
  in: int, number of points M
`ioption`
  in: int, 0: raw discretization; 1: weighted discretization

Return value
  Returns a 1 `x` M matrix with the discretized data.
See also
  `countc`

## double

    double(const ma);

`ma`
  in: arithmetic type

Return value
  Casts the argument to a double:
  - integer: converted to a double;
  - double: unchanged;
  - matrix: element 0,0;
  - string: element 0 as a double;
  - other types: error.
See also
  `int`, `matrix` explicit type conversion

## dropc, dropr,

    dropc(const ma, const midxc);
    dropr(const ma, const midxr);

`ma`
  in: m `x` n matrix to delete from
`midxc`
  in: p `x` q matrix specifying the index of columns to delete
`midxr`
  in: p `x` q matrix specifying the index of rows to delete

Return value
  The `dropc` function with returns a copy of the input matrix with the specified columns deleted.
  The `dropr` function with returns a copy of the input matrix with the specified rows deleted.
  All functions return an empty matrix if all rows or columns are deleted.
See also
  `deleteifc`, `deleteifr`, `vecindex`

## eigen, eigensym

    eigen(const ma, const amval);
    eigen(const ma, const amval, const amvec);
    eigensym(const ms, const amsval);
    eigensym(const ms, const amsval, const amsvec);

`ma`
  in: m `x` m matrix A
`amval`
  in: address of variable
  out: complex eigenvalues: 2 `x` m matrix with eigenvalues of A, first row is real part, second row imaginary part. Only real eigenvalues: 1 `x` m matrix. The eigenvalues are not sorted.
`amvec`
  in: address of variable
  out: complex eigenvalues: 2m `x` m matrix with eigenvectors of A in columns (real values are in first m rows). Only real eigenvalues: m `x` m matrix with eigenvectors in columns.
`ms`
  in: symmetric m `x` m matrix As
`amsval`
  in: address of variable
  out: 1 `x` m matrix with eigenvalues of As, sorted in decreasing order
`amsvec`
  in: address of variable
  out: n `x` m matrix with eigenvectors of As in columns

Return value
  Solves the eigenproblem Ax = \lambda x, returning the result of the eigenvalue decomposition:
  - 0: no error;
  - 1: maximum no of iterations (50) reached.

## eigensymgen

    eigensymgen(const ma, const mb, const amval, const amvec);

`ma`
  in: m `x` m symmetric matrix A
`mb`
  in: m `x` m symmetric positive definite matrix B
`amval`
  in: address of variable
  out: 1 `x` m matrix with (generalized) eigenvalues of A, sorted in decreasing order
`amvec`
  in: address of variable
  out: n `x` m matrix with (generalized) eigenvectors of A in columns

Return value
  Solves the general eigenproblem Ax = \lambda Bx. returning the result of the eigenvalue decomposition:
  - 0: no error;
  - 1: maximum no of iterations (50) reached.
  - -1: Choleski decomposition failed.
See also
  `decldl`, `eigensym`

## eprint

    eprint(const a, ...);

`a`
  in: any type
`...`
  in: any type

Return value
  Returns the number of arguments supplied to the function. Prints to stderr. See `print` for a further description.
See also
  `fprint`, `print`, `sprint`

## erf

    erf(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the error function of each element of `ma`, of double or matrix type.
See also
  `cexp`

## exclusion

    exclusion(const ma, const mb);

`ma, mb`
  in: matrix

Return value
  Returns the sorted unique elements of `ma` which are not in `mb` as a row vector. Returns an empty matrix if the result is empty. Missing values are skipped.
See also
  `intersection`, `unique`

## exit

    exit(const iexit);

`ma`
  in: integer, exit code

No return value.
Exits Ox, with the specified exit code.

## exp

    exp(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the exponent of each element of `ma`, of double or matrix type.
See also
  `log`

## expint

    expint(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the exponent integral Ei of each element of `ma`, of double or matrix type. Note that E1(x)=-Ei(-x).

## fabs

    fabs(const ma);

`ma`
  in: int, double, matrix

Return value
  Returns the absolute value of each element of `ma`, of the same type as `ma`.

## fclose

    fclose(const file);

`file`
  in: an open file which is to be closed
  (use `fclose("l")` to close the log file).

Return value
  Returns 0.
See also
  `fopen`

## feof, fflush

    feof(const file);
    fflush(const file);

`file`
  in: an open file

Return value
  `feof` checks for end of file; returns 0 if not at end of file, a non-zero value otherwise. `fflush` flushes the file buffer.

## fft

    fft(const ma);
    fft(const ma, const inverse);

`ma`
  in: 2 `x` n matrix (first row is real part, second row imaginary part), or 1 `x` n matrix (real part only, imaginary part is zero)
`inverse`
  in: (optional argument), int: 1 (do an inverse FFT) or 2 (do an inverse real FFT)

Return value
  If only one argument is used, the return value is a 2 `x` s matrix which holds the Fourier transform.

  If `inverse` equals 1, the return value is a 2 `x` s matrix which holds the inverse Fourier transform.

  If `inverse` equals 2, the return value is a 1 `x` s matrix which holds the real inverse Fourier transform.

  s is the smallest power of 2 which is >= n.

## floor

    floor(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the floor of each element of `ma`, of double or matrix type. The floor is the largest integer less than or equal to the argument.
See also
  `ceil`, `round`, `trunc`

## fmod

    fmod(const ma, const mb);

`ma`
  in: arithmetic type
`mb`
  in: arithmetic type

Return value
  Returns the floating point remainder of `ma` / `mb`. The sign of the result is that of `ma`. The return type is double if both `ma` and `mb` are int or double. If `ma` is a matrix, the return type is a matrix of the same size, holding the floating point remainders `ma`[i][j] / `mb`[i][j], etc. The return type is derived as follows:
  - m `x` n matrix, when `ma` is an m `x` n matrix, and `mb` is scalar;
  - m `x` n matrix, when `ma` is a scalar, and `mb` is an m `x` n matrix;
  - m `x` n matrix, when `ma` is an m `x` n matrix, and `mb` is an m `x` n matrix;
  - double, when `ma` and `mb` are scalar.
See also
  `imod`

## fopen

    fopen(const filename);
    fopen(const filename, const smode);

`filename`
  in: name of file to open
`smode`
  in: text with open mode

Return value
  Returns the opened file if successful, otherwise the value 0.
Description
  Opens a file. The first form, without the `smode` argument opens a file for reading (equivalent to using `"r"`). The `smode` argument can be:
  - `"w"` open for writing;
  - `"a"` open for appending;
  - `"r"` open for reading;
  - `"r+"` open for reading and writing (update);
  - `"l"` open a log file.

  When using "r+", it is necessary to use `fseek` or `fflush` when switching from reading to writing.

  In addition, the following letters can be used in the `smode` argument:

  b
    Opens the file in binary mode. This makes a difference under MS-DOS and Windows, but only for the treatment of end-of-line characters. Binary leaves a \n as \n, whereas non-binary translates \n to \r\n on output (and vice versa on input). On Windows/MS-DOS systems, it is customary to open text files without the b, and binary files (when using fread and fwrite) with the b.
  f
    When the file has a `.fmt` extension, and the letter f is appended to the format (as e.g. `"rbf"`), the matrix file is opened in formatted mode. In that case, reading and writing can occur by blocks of rows. When writing, the file must be explicitly closed through a call to `fclose`. Note that {\tt .fmt} files written by Gauss on Unix platforms cannot be opened this way (unless the use the v96 format).

    This can also be used for a v96 `.dat` file, which stores variable names as well as binary data. When writing, the first `fwrite` should be an array of strings, which also determines the number of variables. When reading, used `fread(file, &as, 's')` to read the variable names; this resets the file pointer to the first row.

  F
    Same as `'f'`, except using the v96 format instead of extended v89.
  e
    Forces the file reading and writing (using fread and fwrite) to be in little-endian mode. This allows Ox on Unix (not Linux on Intel) to handle files which use the MS-DOS byte ordering (which is little-endian).
  E
    Forces the file reading and writing (using fread and fwrite) to be in big-endian mode. This allows Ox on Windows/MS-DOS to handle files which use the Unix (not Linux on Intel) byte ordering (which is big-endian).
  To send the output from all `print` and `println` statements to a file (in addition to the screen), use `fopen(`filename`, "l")`.
See also
  `fclose`, `fflush`, `fprint`, `fread`, `fscan`, `fseek`, `fwrite`

## format

    format(const sfmt);

`sfmt`
  in: string: new default format for double or int
  int: new line length for matrix printing

No return value.
Description
  Use this function to specify the default format for double and int types. The function automatically recognizes whether the format string is for int or double (otherwise it is ignored). The specified double format will also be used for printing matrices. See under the `print` function for a complete description of the formatting strings. Use an integer argument to set the line length for matrix printing (default is 80, the maximum is 1024). The default format strings are:
  - int: `"%d"`
  - double: `"%g"`
  - matrix: each element `"%#13.5g"`, 6 elements on a line (depending on the line length). This format will always leave at least one space between numbers.
See also
  `fprint`, `print`, `sprint`

## fprint, fprintln

    fprint(const file, const a, ...);
    fprintln(const file, const a, ...);

`file`
  in: file which is open for writing
`a`
  in: any type
`...`
  in: any type

Return value
  Returns the number of arguments supplied to the function. Prints to the specified file, see `print` for a further description. `fprintln` is as `fprint` but ensures the next output will be on a new line.

## fread

    fread(const file, const am);
    fread(const file, const am, const type);
    fread(const file, const am, const type, const r);
    fread(const file, const am, const type, const r,const c);

`file`
  in: file which is open for writing
`am`
  in: address, address for storing read item
`type`
  in: (optional argument), type of object to read, see below
`r`
  in: (optional argument), number of rows to read; default is 1 if argument is omitted
`c`
  in: (optional argument), number of columns to read; default is 1 if argument is omitted, unless file is opened with f, in which case the number of columns is read from the file

Return value
  Returns an integer:
  -1 nothing read, because end-of-file was reached;
  0 nothing read, unknown error;
  >0 object read, return value is size which was actually read:
    - type: 'i', 'd', reads: integer, returns: 1;
    - type: 'e', 'f', reads: double, returns: 1 (r and c omitted, or both equal to 1);
    - type: 'e', 'f', reads: matrix, returns: r `x` c;
    - type: 'e', 'f', reads: matrix, returns: r (number of complete columns read; file opened with f in format);
    - type: 'c', reads: integer, returns: 1 (r=1: just one byte read);
    - type: 'c', reads: string, returns: r (r>1: r bytes read).
    - type: 's', reads: string, returns string length; unlike 'c' this ignores the `r` argument and reads up to (and including) the first null character or the end of file.
    - type: '4', reads: float, returns: 1 (r and c omitted, or both equal to 1);
    - type: '4', reads: matrix of floats, returns: r `x` c;
  When reading a matrix, for example as `fread(file,&x,'f',r,c)`, the size of `x` will always be `r` by `c`. If less than `rc` elements could be read, the matrix is padded with zeros. If no elements could be read at all, because the end of the file was reached, the return value is -1. The `'4'` format reads 4-byte real values (`float'), these are not written by Ox, but may be needed to read externally created files.
Description
  Reads binary data from the specified file. The byte ordering is the platform specific ordering, unless the f format was used (also see `fopen` and `fwrite`).
See also
  `fclose`, `fopen`, `fscan`, `fseek`, `fwrite`

## fremove

    fremove(const filename);

`filename`
  in: name of file to remove

Return value
  Returns 1 if the file was removed successfully, 0 otherwise.

## fscan

    fscan(const file, const a, ...);

`file`
  in: file which is open for writing
`a`
  in: any type
`...`
  in: any type

Return value
  Returns the number of arguments successfully scanned and assigned, or -1 when the end of the file was encountered and nothing was read.
Description
  Reads text from a file. The arguments are a list of scanning strings and the addresses of variables. A scanning string consists of text, optionally with a format specifier which starts with a % symbol. The string is truncated after the format. Any text which precedes the format, is skipped in the file. A space character will skip any white space in the file. If the scanning string holds a format (and assignment is not suppressed in the format), the string must be followed by the address of a variable. The format specification is similar to that for the scanf function of the C language:

  %[`*` or `#`][width]type

  The width argument specifies the width of the input field. A `*` suppresses assignment. A `#` can only be used with `m` and `M`.

  ### Table std.1: Formatting types for scanning

      double type:
      e,f,g       field is scanned as a double value,
      le,lf,lg    field is scanned as a double value,

      integer type:
      d           signed decimal notation,
      i           signed decimal notation,
      o           unsigned octal notation,
      x           unsigned hexadecimal notation,
      u           unsigned decimal notation,
      c           (no width) scan a single character (i.e. one byte),

      string type:
      s           scan a string up to the next white space,
      z           scan a whole line,
      c           (width &gt; 1) scan a number of characters,

      matrix type:
      m,M         scan a matrix row by row.

  Notes:

  - The `"%m"` and `"%M"` formats can be used to read a matrix from a file. They first read the number of rows and columns, and then the matrix row by row; this corresponds to the format used by `loadmat`. No dimensions are read by `"%#m"` and `"%#M"`, in that case the scanning string has to be followed by two integers indicating the number of rows and columns to be read. For `fscan` and `sscan`, the two integers can be $-1$. In that case all numbers are read and returned as a column vector.
  - The `"%z"` format reads a whole line up to `\n`, the `\n` (and `\r`) are removed from the return value. The line can be up to 2048 characters long (or whatever buffer size is set with `sprintbuffer`). If the line in the file is too long, the remainder is skipped. When scanning a string, the maximum string length which can be read is 2048. The `sprintbuffer` function can be used to enlarge the buffer size.
See also
  `fprint`, `fread`, `scan`, `sscan`

## fseek

    fseek(const file);
    fseek(const file, const type);
    fseek(const file, const type, const r);

`file`
  in: file which is open for writing
`type`
  in: (optional argument), type of object use in seeking, see below
`r`
  in: (optional argument), number of rows to move; default is 1 if argument is omitted

Return value
  The first form, with only the `file` argument, tells the current position in the file as an offset from that start of the file (as the standard C function `ftell`). The second and third form return 0 if the seek was successful, else a non-zero number,
Description
  Repositions the file pointer to a new position specified from the start of a file. The `type` argument is interpreted as follows:
  - type: 'i', 'd', seeks: integer, byte equivalent: 4r;
  - type: 'e', 'f', seeks: double, byte equivalent: 8r;
  - type: 'e', 'f', seeks: matrix rows, byte equivalent: 16+8rc (file opened with f in format);
  - type: 'c', seeks: character, byte equivalent: r.

  So when a file is opened as `"rbf"`, `fseek(file, 'f', r)` moves the file pointer to row `r` in the `.fmt` file.

  To position the file pointer at the end specify -1 for the third argument. This can be used to determine the length of a file.

See also
  `fclose`, `fopen`

## fsize

    fsize(const file);

`file`
  in: an open file

Return value
  Returns the size of the file in bytes (an integer).

## fwrite

    fwrite(const file, const a);

`file`
  in: file which is open for writing
`a`
  in: int, double, matrix or string

Return value
  Returns 0 if failed to write, or the number of items written to the file:
  - integer: 1;
  - double: 1;
  - m `x` n matrix: number of elements written (normally m `x` n);
  - m `x` n matrix: opened with f format: no of rows written (normally m);
  - string: number of characters written.
Description
  Writes binary data to the specified file. The byte ordering is the platform specific ordering, unless the f format was used (also see `fopen`), in which case writing is to a `.fmt` file in little endian mode (also see `savemat`). When data is written to a `.fmt` file, the number of columns must match that already in the file (use `columns(file)` to ask for the number of columns in the file).
See also
  `fclose`, `fopen`, `fread`, `fseek`

## fuzziness

    fuzziness(const deps);

`deps`
  in: double, 0 or new fuzziness value

Return value
  Sets and returns the new fuzziness parameter if `deps` >0. If `deps` <= 0, no new fuzziness value is set, but the current one is returned. The default fuzziness is 1e-15.
See also
  `isfeq`

## gammafact

    gammafact(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the complete gamma function at the value of each element of `ma`, of double or matrix type. Returns +.Inf for any argument which is zero or a negative integer. Note that gammafact(n+1) equals n!.
See also
  `gammafact`, `gammafunc`, `polygamma`

## gammafunc

    gammafunc(const dx, const dr);

`mx`
  in: x, arithmetic type
`mr`
  in: r, arithmetic type

Return value
  Returns the incomplete gamma function Gx(r). Returns 0 if r <= 0 or x <= 0. The accuracy is to about 10 digits. The return type is derived as follows:
  - m `x` n matrix, when `mx` is an m `x` n matrix, and `mr` is scalar;
  - m `x` n matrix, when `mx` is a scalar, and `mr` is an m `x` n matrix;
  - m `x` n matrix, when `mx` is an m `x` n matrix, and `mr` is an m `x` n matrix;
  - double, when `mx` and `mx` are scalar.

## getcwd

    getcwd();

Return value
  Returns the current directory.

  Windows specific: returns the current directory on the current drive. Use chdir to change to the current drive.

See also
  `chdir`, `systemcall`

## getenv

    getenv(const senv);

`senv`
  in: string

Return value
  Returns a string with the value of the environment variable, or an empty string if the environment variable is undefined.

## idiv, imod

    idiv(const ia, const ib);
    imod(const ia, const ib);

`ia`
  in: arithmetic type
`ib`
  in: arithmetic type

Return value
  The `imod` function returns the integer remainder of `int(ia)` / `int(ib)`. The sign of the result is that of `ia`. The `idiv` function returns the result of the integer division `int(ia)` / `int(ib)`. The return type is a matrix of integer values if either arguments is a matrix, else it is a scalar int.
See also
  `fmod`

## insertc, insertr

    insertc(const ma, const c, const cadd);
    insertr(const ma, const r, const radd);

`ma`
  in: m `x` n matrix to insert into
`c`
  in: scalar, column index of insertion
`cadd`
  in: scalar, number of columns of zeros to add
`r`
  in: scalar, row index of insertion
`radd`
  in: scalar, number of rows of zeros to add

Return value
  The `insertc` function with returns a copy of the input matrix with the specified columns of zeros inserted.
  The `insertr` function with returns a copy of the input matrix with the specified rows of zeros inserted.
See also
  `dropc`, `dropr`

## int

    int(const ma);

`ma`
  in: arithmetic type

Return value
  Casts the argument to an integer:
  - integer: unchanged;
  - double: rounded towards zero;
  - matrix: element 0,0 rounded towards zero;
  - string: element 0;
  - other types: error.
See also
  `ceil`, `double` , `matrix` , `trunc`, explicit type conversion

## intersection

    intersection(const ma, const mb);

`ma, mb`
  in: matrix

Return value
  Returns the sorted unique elements of `ma` which are also in `mb` as a row vector. Returns an empty matrix if the result is empty. Missing values are skipped.
See also
  `exclusion`, `unique`

## invert

    invert(const ma);
    invert(const ma, const alogdet, const asign);

`ma`
  in: m `x` m real matrix A
`alogdet`
  in: (optional argument) address of variable
  out: double, the logarithm of the absolute value of the determinant of A
`asign`
  in: (optional argument) address of variable
  >out: int , the sign of the determinant of A; 0: singular; -1,-2: negative determinant; +1,+2: positive determinant; -2,+2: result is unreliable

Return value
  Returns the inverse of A, or the value 0 if the decomposition failed.
See also
  `decldl`, `invertgen`, `invertsym` `logdet`

## inverteps

    inverteps(const dEps);

`dEps`
  in: sets the inversion epsilon epsinv to `dEps` if `dEps` > 0, to the default if `dEps` < 0; leaves the value unchanged if `dEps` == 0

Return value
  Returns the inversion epsilon (the new value if `dEps != 0`).

## invertgen

    invertgen(const ma);
    invertgen(const ma, const mode);

`ma`
  in: m `x` n real matrix A
`mode`
  in: inversion mode (optional argument, default is 0)

Return value
  Returns the (generalized) inverse of A, or the value 0 if the decomposition failed:

      mode     description                                A
      0        generalized inverse using SVD
      1        generalized symmetric inverse using SVD   m=n
      2,20     first try invert then mode 0              m=n
      3,30     first try invertsym then mode 1           m=n
      4,40     use olsc (QR dec.) for inverse of A'A     m>=n
      >=10     print warning if matrix is singular

See also
  `invert`, `invertsym`

## invertsym

    invertsym(const mas);
    invertsym(const mas, const alogdets);

`ma`
  in: symmetric, positive definite m `x` m matrix A
`alogdet`
  in: (optional argument) address of variable
  out: double, the logarithm of the determinant of A.

Return value
  Returns the inverse of A, or the value 0 if the decomposition failed.
See also
  `declu`, `invert`, `invertgen`

## isarray, isclass, isdouble, isfile, isfunction, isint ismatrix isstring

    isarray(const a);
    isclass(const a);
    isclass(const a, const sclass);
    isdouble(const a);
    isfile(const a);
    isfunction(const a);
    isint(const a);
    ismatrix(const a);
    isstring(const a);

`a`
  in: any type
`sclass`
  in: string, class name

Return value
  Returns TRUE (i.e. the value 1) if the argument is of the correct type, FALSE (0) otherwise.

  `isclass(a, "class")` returns TRUE if `a` is an object of type `"class"`, or derived from `"class"`.

## isdotfeq, iseq, isfeq

    isdotfeq(const ma, const mb);
    iseq(const ma, const mb);
    isfeq(const ma, const mb);

`ma`
  in: arithmetic type
`mb`
  in: arithmetic type

Return value
  `isfeq` always returns an integer: it returns 1 if the argument `ma` is fuzzy equal to `mb`, 0 otherwise. When strings are compared, the comparison is case insensitive.

  `iseq` is as `isfeq`, but using fuzziness of zero. When strings are compared, the comparison is case sensitive.

  `isdotfeq` returns a matrix if either argument is a matrix; the matrix consists of 0's and 1's: 1 if the comparison holds, 0 otherwise. If both arguments are scalar, `isdotfeq` is equal to `isfeq`. In both cases the current fuzziness value is used.

See also
  `fuzziness`

## isdotinf

    isdotinf(const ma);

`ma`
  in: arithmetic type

Return value
  `isdotinf` returns a matrix of the same dimensions if the input is a matrix; the returned matrix consists of 0's and 1's: 1 if the element is +/- infinity, 0 otherwise. If the arguments is a double, `isdotnan` returns 1 if the double is +/- infinity.
See also
  `isdotnan`

## isdotnan, isnan

    isdotnan(const ma);
    isnan(const ma);

`ma`
  in: arithmetic type

Return value
  `isnan` always returns an integer: it returns 1 if any element in `ma` is a NaN (not a number), 0 otherwise. NaN can be used to indicate a missing value.
  `isdotnan` returns a matrix of the same dimensions if the input is a matrix; the returned matrix consists of 0's and 1's: 1 if the element is NaN, 0 otherwise. If the arguments is a double, `isdotnan` returns 1 if the double is NaN.
See also
  `deletec`, `deleter`, `selectc`, `selectr`

## lag0

    lag0(const ma, const ilag);
    lag0(const ma, const ilag, double dmisval);

`ma`
  in: T `x` n matrix
`ilag`
  in: int, lag length, or matrix with lag lengths
`dmisval`
  in: (optional argument) double, value to set missing observations to (default is 0)

Return value
  Returns the lags of the specified matrix, whereby missing values are replaced by zero. The result has the same dimensions as `ma`.
  If `ilag` is a matrix the return value corresponds to: `lag0(.,ilag[0])~lag0(.,ilag[1])~...`
See also
  `diff0`

## limits

    limits(const ma);

`ma`
  in: m `x` n matrix

Return value
  Returns a 4 `x` n matrix:
  - 1st row: minimum of each column of `ma`;
  - 2nd row: maximum of each column of `ma`;
  - 3rd row: row index of minimum (lowest index if more than one exists);
  - 4th row: row index of maximum (lowest index if more than one exists).
See also
  `min`, `max`

## loadmat

    loadmat(const sname);
    loadmat(const sname, const iFormat);

`sname`
  in: string containing an existing file name
`iFormat`
  in: (optional argument, `.mat` matrix file only) 1: file has no matrix dimensions; then the matrix is returned as a column vector, and `shape` could be used to create a differently shaped matrix.

Return value
  Returns the matrix which was read, or `0` if the operation failed.
Description
  The type of file read depends on the extension of the file name:
  - `.mat`: ASCII matrix file, described below,
  - `.dat`: ASCII data file with load information,
  - `.in7`: PcGive 7 data file (with corresponding `.bn7` file),
  - `.xls`: Excel worksheet or workbook file,
  - `.wks` and `.wk1`: Lotus spread sheet file,
  - `.dta`: Stata data file (version 4--6),
  - `.dht`: Gauss data file (v89, with corresponding `.dat` file),
  - `.fmt`: Gauss matrix file (v89 and v96);
  - any other: as `:.mat`: file. A matrix file holds a matrix, preceded by two integers which specify the number of rows and columns of the matrix.
  A matrix file holds a matrix, preceded by two integers which specify the number of rows and columns of the matrix. It will normally have the `.mat` extension. White space and a comma between numbers is skipped. If a symbol is found which is not a number, then the rest of the line will be skipped (so, e.g. everything following ; or // is treated as comments). The exception to this is an isolated dot, the letter `m` or `M` or the word `.NaN`: these are interpreted as a missing element with value NaN (Not a Number); `.Inf` is interpreted as infinity.
See also
  `Database` class, `savemat`, `shape`

## log, log10

    log(const ma);
    log10(const ma);

`ma`
  in: arithmetic type

Return value
  The `log` function returns the natural logarithm of each element of `ma`, of double or matrix type.

  The `log10` function returns the logarithm (base 10) of each element of `ma`, of double or matrix type.

See also
  `exp`

## logdet

    logdet(const ma, const asign);

`ma`
  in: m `x` m real matrix A
`asign`
  in: address of variable
  >out: int, the sign of the determinant of A; 0: singular; -1,-2: negative determinant; +1,+2: positive determinant; -2,+2: result is unreliable

Return value
  Returns a double: the logarithm of the absolute value of the determinant of A (1.0 if the matrix is singular).
See also
  `determinant`, `invert`

## loggamma

    loggamma(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the logarithm of the complete gamma function at the value of each element of `ma`, of double or matrix type. Returns +.Inf for an argument equal to zero, and .NaN for arguments less than zero. Note that exp(loggamma(n+1)) equals n!.
See also
  `gammafact`, `gammafunc`, `polygamma`

## lower

    lower(const ma);

`ma`
  in: m `x` n matrix

Return value
  Returns the lower diagonal (including the diagonal), i.e. returns a copy of the input matrix with strict upper-diagonal elements set to zero.
See also
  `setdiagonal`, `setupper`, `setlower`, `upper`

## matrix

    matrix(const ma);

`ma`
  in: arithmetic type

Return value
  Casts the argument to a matrix:
  - integer: a 1 `x` 1 matrix,
  - double: a 1 `x` 1 matrix,
  - matrix: unchanged,
  - string: a 1 `x` 1 matrix,
  - other types: error.
See also
  `int`, `double`, explicit type conversion

## max

    max(const a, ...);

`a`
  in: arithmetic type
`...`
  in: arithmetic type

Return value
  Returns the maximum value in all the arguments. The return type is int if all arguments are of type int; otherwise the return type is double.
See also
  `limits`, `maxc`, `min`

## maxc, maxcindex

    maxc(const ma);
    maxcindex(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `maxc` function returns a 1 `x` n matrix holding the maximum of each column of `ma`.

  The `maxcindex` function returns a 1 `x` n matrix holding the row index of the maximum of each column `ma`.

  Finds the maximum value in each column, ignoring missing values. If no maximum is found (a column has all missing values), then the maximum is `.NaN`, and the index -1.

See also
  `limits`, `max`, `minc`, `mincindex`

## meanc, meanr

    meanc(const ma);
    meanr(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `meanc` function returns a 1 `x` n matrix holding the means of the columns of `ma`.

  The `meanr` function returns a T `x` 1 matrix holding the means of the rows of `ma`.

See also
  `sumc`, `sumr`, `varc`, `variance`, `varr`

## min

    min(const a, ...);

`a`
  in: arithmetic type
`...`
  in: arithmetic type

Return value
  Returns the minimum value in all the arguments. The return type is int if all arguments are of type int; otherwise the return type is double.
See also
  `limits`, `max`, `minc`

## minc, mincindex

    minc(const ma);
    mincindex(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `minc` function returns a 1 `x` n matrix holding the minimum of each column of `ma`.

  The `mincindex` function returns a 1 `x` n matrix holding the row index of the minimum of each column `ma`.

  Finds the minimum value in each column, ignoring missing values. If no minimum is found (a column has all missing values), then the minimum is `.NaN`, and the index -1.

See also
  `limits`, `maxc`, `maxcindex`, `min`

## norm

    norm(const ma);
    norm(const ma, const itype);

`ma`
  in: arithmetic type
`itype`
  in: int, type of norm

Return value
  Computes the norm of a matrix. The type of norm depends on the `itype` argument. When A is a matrix:
  - 0: infinity norm, maximum of absolute column sums,
  - 1: maximum absolute row sums,
  - 2: largest singular value,
  - 'F': Frobenius norm: square root of sum of squared elements.
  - -1: minimum of absolute column sums,
  When A is a vector:
  - 0: infinity norm, maximum absolute value,
  - 1: sum of absolute values,
  - 2: square root of sum of squares,
  - p: p-th root of sum of absolute elements raised to the power p.
  - -1: minimum absolute value,
  `norm(x)` corresponds to `norm(x,0)`.
See also
  `decsvd`, `rank`

## nullspace

    nullspace(const ma);

`ma`
  in: m `x` n matrix A, m >= n

Return value
  Returns the null space of `ma`, or 0 (`ma` is square and full rank), -1 (SVD failed).
See also
  `decsvd`, `inverteps`

## ols2c, ols2r, olsc, olsr

    ols2c(const my, const mx, const amb);
    ols2c(const my, const mx, const amb, const amxtxinv);
    ols2c(const my, const mx, const amb, const amxtxinv,
        const amxtx);

    olsc(const my, const mx, const amb);
    olsc(const my, const mx, const amb, const amxtxinv);
    olsc(const my, const mx, const amb, const amxtxinv,
        const amxtx);

`my`
  in: T `x` n matrix Y
`mx`
  in: T `x` k matrix X
`amb`
  in: address of variable
  out: k `x` n matrix of OLS coefficients, B
`amxtxinv`
  in: (optional argument) address of variable
  out: k `x` k matrix (X'X)-1,
`amxtx`
  in: (optional argument) address of variable
  out: k `x` k matrix (X'X),

    ols2r(const my, const mx, const amb);
    ols2r(const my, const mx, const amb, const amxtxinv);
    ols2r(const my, const mx, const amb, const amxtxinv,
        const amxtx);

    olsr(const my, const mx, const amb);
    olsr(const my, const mx, const amb, const amxtxinv);
    olsr(const my, const mx, const amb, const amxtxinv,
        const amxtx);

`my`
  in: n `x` T matrix Y'
`mx`
  in: k `x` T matrix X', T >= k
`amb`
  in: address of variable
  out: n `x` k OLS coefficient matrix, B'
`amxtxinv`
  in: (optional argument) address of variable
  out: k `x` k matrix (X'X)-1,
`amxtx`
  in: (optional argument) address of variable
  out: k `x` k matrix (X'X),

Return value
  - 0: out of memory,
  - 1: success,
  - 2: ratio of diagonal elements of X'X is large, rescaling is advised,
  - -1: (X'X) is (numerically) singular,
  - -2: combines 2 and -1.

## ones

    ones(const r, const c);
    ones(const ma);

`r`
  in: int
`c`
  in: int
`ma`
  in: matrix

Return value
  `ones(r,c)` returns an `r` by `c` matrix filled with ones.
  `ones(ma)` returns a matrix of the same dimension as `ma`, filled with ones.
See also
  `constant`, `unit`, `zeros`

## outer

    outer(const mx, const ms);
    outer(const mx, const ms, const mode);

`mx`
  in: m `x` n matrix X
`ms`
  in: n `x` n symmetric matrix S or empty matrix
`mode`
  in: int, operation mode: 'd' or 'o' (optional argument)

Return value
  `outer(mx,ms)` returns XSX', which is m `x` m.
  `outer(mx,ms,'d')` returns `diagonal`(XSX'), which is 1 `x` m.
  `outer(mx,<>,'o')` returns Sum xixi', which is n `x` n.
See also
  `diagonal`

## oxfilename

    oxfilename(const itype);

`itype`
  in: int, determines output format

Return value
  Returns a string with the name of the Ox source file from which it is called:

      itype  returns            example: oxl D:\waste\func  example: oxl func
      0      full file name     D:\waste\func.ox            func.ox
      1      path of file name  D:\waste\
      2      base name          func                        func
      3      file extension     .ox                         .ox

  In the first two cases the return value depends on how the file is called.

## oxrunerror

    oxrunerror(const smsg, const i01);

`smsg`
  in: int, string, error message text
`i01`
  in: int, 0 or 1

No return value
  Prints the run-time error message. If `i01`=0, the standard Ox call trace is printed; if `i01`=1, the top level function call is skipped (in case the error is raised in a error handler function).

## oxversion

    oxversion();

Return value
  Returns an integer with the version of Ox multiplied by 100. So for version 1.10 the return value is 110.

## oxwarning

    oxwarning(const flset);

`flset`
  in: int, new warnings settings

Return value
  Returns the previous warnings settings.
  Controls the reporting of run-time warning messages. Currently, there are three types of messages controlled by this function:
  - `WFL_DECFAILED` decomposition failed,
  - `WFL_ITMAX` maximum no. of iterations reached,
  - `WFL_CONCAT` concatenation dimensions don't match,
  - `WFL_VECIDXMAT` indexed a matrix as a vector.
  The first occurs when an inversion or decomposition fails, the second could happen in an eigenvalue based function. The concatenation message is printed when the dimensions don't match, and the results has been padded with zeros. The message related to `WFL_VECIDXMAT` is given when a matrix which is not a row or column vector is indexed with just one index. However, the message is not given when using an empty single index `[]`, which has the same effect as the `vecr` function.

  You can add the flags together to specify warning settings. Use `oxwarning(0)` to switch both these messages off, and `oxwarning(-1)` to switch them all on.

## periodogram

    periodogram(const ma);
    periodogram(const ma, const itrunc, const cpoints,
        const imode);

`ma`
  in: arithmetic type, T `x` n matrix
`itrunc`
  in: int, truncation parameter m, if >= T then T-1 is used
`cpoints`
  in: int, no of points N at which to evaluate periodogram
`imode`
  in: 0: (truncated) periodogram (times T), 1: smoothed periodogram (times T) using Parzen window, 2: estimated spectral density using Parzen window (as option 1, but divided by c0).

Return value
  - `periodogram(ma);`
    Returns a N+1 by n matrix with T times the periodogram computed at the Fourier frequencies 0, 2\pi/T, ..., 2N\pi/T, where N=int(T/2).
  - `periodogram(ma, itrunc, N, 0);`
    Returns a N by n matrix with the periodogram of the columns of `ma` using autocovariances up to lag `itrunc`, computed at frequencies: 0, \pi/(N-1), ..., \pi.
  - `periodogram(ma, itrunc, N, 1);`
    Returns a N by n matrix with the smoothed periodogram of the columns of `ma` using autocovariances up to lag `itrunc`, computed at frequencies: 0, \pi/(N-1), ..., \pi.
  - `periodogram(ma, itrunc, N, 2);`
    Returns a N by n matrix with the spectral density of the columns of `ma` using autocorrelations up to lag `itrunc`, computed at frequencies: 0, \pi/(N-1), ..., \pi.
See also
  `DrawSpectrum`.

## polydiv

    polydiv(const ma, const mb, const cp);

`ma`
  in: 1 `x` m matrix A = (a0 ... am-1) specifying the A polynomial (see below)
`mb`
  in: 1 `x` n matrix B = (b0 ... bn-1) specifying the B polynomial (see below)
`cp`
  in: int, required length, p, of polynomial resulting from division

Return value
  Returns a 1 `x` p matrix with the coefficients of polynomial resulting from dividing the A polynomial by the B polynomial. The integer 0 is returned when b0 is 0, or p=0.
See also
  `polymake`, `polymul`, `polyroots`

## polygamma

    polygamma(const ma, const mn);

`ma`
  in: arithmetic type
`mn`
  in: arithmetic type, order of derivative: 0 = first derivative, 1 = second derivative, etc.

Return value
  Returns the derivative of the logarithm of the complete gamma function at the value of each element of `ma`, of double or matrix type. The second argument specifies the order of the derivative. Returns zero for any argument less than or equal to zero, or derivative order less than 0. The return type is derived as follows:
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest is scalar (int);
  - m `x` n matrix, when `ma` is a scalar, and the rest are m `x` n matrices;
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest are m `x` n matrices;
  - double, when `ma` is scalar, and the rest is also scalar (int).
See also
  `loggamma`

## polymake

    polymake(const roots);

roots
  in: 2 `x` m matrix with (inverse) roots of the polynomial, first row is real part, second row imaginary part (or 1 `x` m matrix if all roots are real).

Return value
  Returns the coefficients of the polynomial (a0 = 1) as a 2 `x` (m+1) matrix if the roots had a complex part, else 1 `x` (m+1).
See also
  `polyroots`

## polymul

    polymul(const ma, const mb);

`ma`
  in: 1 `x` m matrix A = (a0 ... am-1) specifying the A polynomial (see below)
`mb`
  in: 1 `x` n matrix B = (b0 ... bn-1) specifying the B polynomial (see below)

Return value
  Returns a 1 `x` (m+n-1) matrix with the coefficients of the product of the polynomials.
See also
  `polydiv`, `polymake`, `polyroots`

## polyroots

    polyroots(const ma, const amroots);

`ma`
  in: 1 `x` (m+1) matrix A = (a0 ... am) specifying the polynomial of order m (see below)
amroots
  in: address of variable
  out: 2 `x` m matrix with roots of the polynomial first row is real part, second row imaginary part (all zeros if the roots are real). The roots are not sorted.

Return value
  Returns the result of the eigenvalue decomposition:
  - 0: no error;
  - 1: maximum no of iterations (50) reached.
See also
  `eigen`, `polydiv`, `polymake`, `polymul`

## pow

    pow(const ma, const p);

`ma`
  in: arithmetic type

Return value

Returns `ma .^ p`. This is identical to using the dot-power operator, with the exception that if both `ma` and `p` are an integer, the return type is a double.

See also
  `sqr`, `^ .^`

## print, println,

    print(const a, ...);
    println(const a, ...);

`a`
  in: any type
`...`
  in: any type

Return value
  Returns the number of arguments supplied to the function.
Description
  Each argument is printed to stdout using default formatting. A formatting string can be input in the input stream: a formatting string starts with a % symbol, and is followed by one or more characters. If a formatting string is encountered, it is not printed, but applied to the next argument. There is an additional option to add column and row labels for a matrix, or specify a different format for each matrix column:
  - `%r` the next argument contains row labels (array of strings),
  - `%c` the next argument contains column labels (array of strings).
  - `%cf` the next argument contains column formats (array of strings)

  The default format strings are:

  - no value: `"null"`,
  - int: `"%d"`,
  - double: `"%g"`,
  - matrix: `"\n"`, then each element `"%#12.5g"`, 6 elements on a line (5 if row is labelled), no labels,
  - string: `"%s"`,
  - array: `"&0x%p"`,
  - function: `"&%d"`,
  - class: `"&0x%p"`,
  - library function: `"&0x%p"`. The `format` function may be used to set a different default format; it also lists the format options.

  The format specification is similar to that for the printf function of the C language:

  %[flag][width][.precision]type

  ### Table std.2: Formatting flags for doubles and integers

      -        left adjust in output field,
      +        always print a sign,
      space    prefix space if first character is not a sign
      0        pad with leading zeros,
      #        alternate output form:
               type is o: first digit will be 0,
               type is xX: prefix with 0x or 0X (unless value is 0),
               type is eEfgG: always print decimal point,
               type is gG: keep trailing zeros.
               type is mM: omit dimensions.

  The width argument specifies the width of the output field. The precision argument specifies the number of significant digits (type is `gG`) number of digits after the decimal point (type is `eEf`); the default is 6 if precision is absent.

  ### Table std.3: Formatting types for printing

      double type, also used for matrices:
      g,G       %e or %E if the exponent is <-4
                or >= precision; else use %f,
      e,e       scientific notation: with exponent,
      f         print without exponent,

      specials for matrices:
      r         followed by row labels (array of strings),
      c         followed by column labels (array of strings),
      cf        followed by column formats (array of strings),
          e.g.: print("%c",{"a","b"},"%cf",{"8.4g","6.2g"},m);

      integer type:
      d,i       signed decimal notation,
      o         unsigned octal notation,
      x,X       unsigned hexadecimal notation,
      u         unsigned decimal notation,
      c         print as a single character (i.e. one byte),

      string type:
      s         string format.

      matrix type:
      m         print matrix row by row using %25.26e.
      M         print matrix row by row with the default format.

  `println` is as `print` but ensures the next output will be on a new line.

See also
  `eprint`, `format`, `fprint`, `fscan`, `fwrite`, `sprint`

## probchi, probf, probn, probt

    probchi(const ma, const df);
    probchi(const ma, const df, const nc);
    probf(const ma, const df1, const df2);
    probf(const ma, const df1, const df2, const nc);
    probn(const ma);
    probt(const ma, const df);
    probt(const ma, const df, const nc);

`ma`
  in: arithmetic type
`df`
  in: arithmetic type, degrees of freedom
`df1`
  in: arithmetic type, degrees of freedom in the numerator
`df2`
  in: arithmetic type, degrees of freedom in the denominator
`nc`
  in: arithmetic type, non-centrality parameter

Return value
  Returns the requested probabilities at `ma` (the returned probabilities are between zero and one):
  - `probchi`: probabilities from chi2(df) distribution,
  - `probchi`: probabilities from non-central chi2(df) distribution,
  - `probf`: probabilities from F(df1, df2) distribution,
  - `probf`: probabilities from non-central F(df1, df2) distribution,
  - `probn`: one-sided probabilities from the standard normal N(0,1),
  - `probt`: one-sided probabilities from student-t(df) distribution,
  - `probt`: one-sided probabilities from non-central student-t(df) distribution.

  The probabilities are accurate to about 10 digits. The return type is derived as follows:

  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest is scalar;
  - m `x` n matrix, when `ma` is a scalar, and the rest are m `x` n matrices;
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest are m `x` n matrices;
  - double, when `ma` is scalar, and the rest is also scalar.
See also
  `dens...`, `quan...`, `tail...`, Probability package

## prodc, prodr

    prodc(const ma);
    prodr(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `prodc` function returns a 1 `x` n matrix `r` which holds the product of all column elements of `ma`.

  The `prodr` function returns a T `x` 1 matrix which holds the product of all row elements of `ma`.

See also
  `sumc`, `sumr`

## quanchi, quanf, quann, quant

    quanchi(const ma, const df);
    quanf(const ma, const df1, const df2);
    quann(const ma);
    quant(const ma, const df);

`ma`
  in: arithmetic type, probabilities: all values must be between 0 and 1
`df`
  in: arithmetic type, degrees of freedom
`df1`
  in: arithmetic type, degrees of freedom in the numerator
`df2`
  in: arithmetic type, degrees of freedom in the denominator
`dr`, `da`
  in: arithmetic type

Return value
  Returns the requested quantiles (inverse probability function; percentage points) at `ma`:
  - `quanchi`: quantiles from chi2(df) distribution,
  - `quanf`: quantiles from F(df1, df2) distribution,
  - `quann`: standard normal quantiles,
  - `quant`: quantiles from student-t(df) distribution.

  The quantiles are accurate to about 10 digits. The return type is derived as follows:

  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest is scalar;
  - m `x` n matrix, when `ma` is a scalar, and the rest are m `x` n matrices;
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest are m `x` n matrices;
  - double, when `ma` is scalar, and the rest is also scalar.
See also
  `dens...`, `prob...`, `tail...` Probability package

## quantilec, quantiler

    quantilec(const ma);
    quantiler(const ma);
    quantilec(const ma, const mq);
    quantiler(const ma, const mq);

`ma`
  in: T `x` n matrix A
`mq`
  in: (optional argument) 1 `x` q matrix of quantiles

Return value
  The `quantilec` function returns a q `x` n matrix holding the requested quantiles of the columns of `ma`. If no second argument is used the return value is a 1 `x` n matrix holding the medians.

  The `quantiler` function returns a T `x` q matrix holding the requested quantiles of the rows of `ma`. If no second argument is used the return value is a T `x` 1 matrix holding the medians.

See also
  `meanc`, `meanr`, `varc`, `varr`

## range

    range(const min, const max);
    range(const min, const max, const step);

`min`
  in: int or double, first value m
`max`
  in: int or double, last value n
`step`
  in: int or double, (optional argument) increment

Return value
  Returns a 1 `x` (n-m+1) matrix with the values with values m, m+1, ..., n. If n<m, `range` returns a 1 `x` (m-n+1) matrix with the values with values m, m-1, ..., n. The version which uses the `step` argument uses that as the incrementor (rather than the default +1 or -1), the returned matrix is a row vector of the required length.
Description
  When all arguments are integers, the incrementation arithmetic is done using integers, else using doubles. Integer arithmetic could be a bit more precise when using longer ranges. The following example illustrates the difference:

      range(-1.1, 1.1, 0.11);
      range(-110, 110, 11) / 100;

  The first line has the loop using floating point arithmetic, and will not have exactly zero, but something like -1.9e-16 as its 11th element. In the second line, the loop is incremented in integer arithmetic before conversion to floating point numbers. Here the 11th number will be exactly zero. Because if these rounding errors, it is best to use the integer version, and scale afterwards.
See also
  `constant`

## rank

    rank(const ma);
    rank(const ma, const eps);

`ma`
  in: arithmetic type
`eps`
  in: arithmetic type, optional tolerance

Return value
  Returns the rank of a matrix, of type int. The rank of a scalar is 1, except for the rank of zero, which is zero. In the one argument version, the rank is also relative to the norm, so that `rank(1e-20)` equals one. The two argument version uses the specified tolerance: `rank(1e-20, 1e-10)` equals zero.
See also
  `decsvd`, `inverteps`, `norm`

## rann

    rann(const r, const c);

`r`
  in: int, number of rows
`c`
  in: int, number of columns

Return value
  Returns a `r` by `c` matrix of random numbers from the standard normal distribution, using drawings from the current uniform random generator.
See also
  `ranseed`, `ranu` Probability package

## ranseed

    ranseed(const iseed);

`iseed`
  in: int (1 seed), or array of ints (multiple seeds)

Return value
  Returns the current seed(s) of the random number generator. If the generator only uses one seed, the return type is int. Otherwise it is an array holding all the seeds (all array elements are integers).
  A call to `ranseed(0)` only returns the current seed, without changing it; `ranseed(-1)` resets to the initial seed and returns the initial seed.
Description
  Sets and gets the seed(s); `ranseed` can also change the random number generator:
  - `"PM"` Modified Park and Miller (period approx. 232)
  - `"GM"` George Marsaglia (period approx. 260)
  - `"LE"` Pierre L'Ecuyer (period approx. 2113)
  The number of seeds is dependent on the rng being used: To set the seed, for example:
  - `"PM"` has 1 seed, example: `ranseed(111);`
  - `"GM"` has 2 seeds, example: `ranseed({111, 1111});`
  - `"LE"` has 4 seeds, example: `ranseed({1,11,111,1111});` In the this case the seeds have to be larger than 1, 7, 15, 127 respectively, otherwise the call is ignored.
See also
  ``rann``, `ranu`

## ranu

    ranu(const r, const c);

`r`
  in: int
`c`
  in: int

Return value
  Returns a `r` by `c` matrix of uniform random numbers. The matrix is filled by row. When both `r` and `c` are 1, the return value is a scalar of type double. The `ranseed` function can be used to change the random number generator.
See also
  ``rann``, `ranseed`

## reflect

    reflect(const ma);

`ma`
  in: square m `x` m matrix

Return value
  Returns the reflected version of `ma`.
See also
  transpose operator `'`

## reshape

    reshape(const ma, const r, const c);

`ma`
  in: arithmetic type
`r`
  in: int
`c`
  in: int

Return value
  Returns an `r` by `c` matrix, filled by row from vecr(`ma`). If there are less than `rc` elements in `ma`, the input matrix is repeated.
See also
  `shape`, `vecr`

## reversec, reverser

    reversec(const ma);
    reverser(const ma);

`ma`
  in: m `x` n matrix A

Return value
  The `reversec` function returns an m `x` n matrix which has the columns of `ma` in reverse order.

  The `reverser` function returns an m `x` n matrix which has the rows of `ma` in reverse order.

See also
  `sortc`, `sortr`

## round

    round(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the rounded elements of `ma`, of double or matrix type. Rounds to the nearest integer.
See also
  `ceil`, `floor`, `trunc`

## rows

    rows(const ma);

`ma`
  in: any type

Return value
  Returns an integer value which is the number of rows in the argument:
  - m `x` n matrix: m;
  - string: number of characters in the string;
  - array: number of elements in the array;
  - file: number of columns in the file; (only if opened with `f` format, see `fopen`);
  - other: 0.
See also
  `columns`, `sizeof`

## savemat

    savemat(const sname, const ma);
    savemat(const sname, const ma, const iFormat);

`sname`
  in: string containing a destination file name
`ma`
  in: matrix
`iFormat`
  in: (optional argument)
  1: omit the matrix dimensions (.mat file only);
  1: save in universal v96 format (.fmt file only)

Return value
  Returns 0 if the operation failed, 1 otherwise.
Description
  The type of file saved depends on the extension of the file name:
  - `.mat`: ASCII matrix file,
  - `.dat`: ASCII data file with load information,
  - `.in7`: PcGive 7 data file (with corresponding `.bn7` file),
  - `.xls`: Excel version 2.1 spread sheet file,
  - `.wks` and `.wk1`: Lotus spread sheet file,
  - `.fmt`: Gauss matrix file: extended v89 (default) or universal v96,
  - `.dht`: Gauss data file: extended v89, with corresponding `.dat` file,
  - any other: as `.mat` file.
See also
  `Database` class, `loadmat`

## scan

    scan(const a, ...);

`a`
  in: any type
`...`
  in: any type

Return value
  Returns the number of arguments successfully scanned and assigned.
Description
  This function works as `fscan`, but reading from the console, not a file. Any text in the scanning string which is not an input is echoed to the console (this is different from the standard C `scanf` function).
See also
  `fscan`, `fwrite`, `sscan`

## selectc, selectr, selectifc, selectifr, selectrc

    selectc(const ma);
    selectc(const ma, const mval);
    selectr(const ma);
    selectr(const ma, const mval);
    selectifc(const ma, const mifc);
    selectifr(const ma, const mifr);
    selectrc(const ma, const mr, const mc);

`ma`
  in: m `x` n matrix to select from
`mval`
  in: p `x` q matrix with values to use for selection
`mifc`
  in: p `x` n boolean matrix specifying columns to select
`mifr`
  in: m `x` q boolean matrix specifying rows to select
`mc`
  in: p `x` n matrix with indices of columns to select
`mr`
  in: m `x` q matrix with indices of rows to select

Return value
  The `selectc` function with one argument returns an m `x` s matrix, selecting columns from `ma` which have a missing value (NaN: not a number).
  The `selectr` function with one argument returns an s `x` n matrix, selecting rows from `ma` which have a missing value (NaN).
  The remaining forms expect matrices without missing values.
  The `selectc` function with two arguments returns an m `x` s matrix, selecting the columns from `ma` which have at least one element equal to an element in the matrix `mval`.
  The `selectr` function with two arguments returns an s `x` n matrix, selecting the rows from `ma` which have at least one element equal to an element in the matrix `mval`.
  The selectif functions can be used to select rows or columns based on a logical expression: all rows (columns) wich have a zero in the corresponding row (column) are dropped.
  The `selectifc` function returns an m `x` s matrix, selecting only those columns from `ma` which have at least one non-zero element in the corresponding column of `mifc`.
  The `selectifr` function returns an s `x` n matrix, selecting only those rows from `ma` which have at least one non-zero element in the corresponding row of `mifr`.
  The `selectrc` function returns a 1 `x` max(pn,mq) matrix, which holds the selected elements. If an index is outside the matrix bounds of `ma` the corresponding element in the return value is NaN.
  All functions return an empty matrix if the selection is empty.
See also
  `deletec`, `deleter`, `deleteifc`, `deleteifr`, `isdotnan`, `vecindex`

## setbounds

    setbounds(const ma, const dlo, const dhi);

`ma`
  in: m `x` n matrix
`dlo`
  in: scalar, lower bound (may be `-.Inf`)
`dhi`
  in: scalar, upper bound (may be `+.Inf`)

Return value
  Returns the specified matrix, replacing values smaller than `dlo` by `dlo` and values greater that `dhi` by `dhi`. Missing values remain missing.

## setdiagonal, setlower, setupper

    setdiagonal(const ma, const mdiag);
    setlower(const ma, const ml);
    setupper(const ma, const mu);
    setlower(const ma, const ml, const mdiag);
    setupper(const ma, const mu, const mdiag);

`ma`
  in: m `x` n matrix
`mdiag`
  in: 1 by min(m,n) or min(m,n) by 1 or matrix m `x` n matrix or scalar
`ml`
  in: scalar or m `x` n matrix with new strict lower diagonal
`mu`
  in: scalar or m `x` n matrix with new strict upper diagonal

Return value
  `setdiagonal` returns a matrix with the diagonal replaced by `mdiag`, which is either a vector with the new diagonal elements, or a matrix from which the diagonal is copied. If `mdiag` is scalar, all diagonal elements of the returned matrix have that value.

  `setlower` returns `ma` with the strict lower diagonal replaced by that of `ml`. `setlower(ma, ml, mdiag)` corresponds to `setdiagonal( setlower(ma, ml), mdiag)`.

  `setupper` returns `ma` with the strict upper diagonal replaced by that of `ml`. `setupper(ma, ml, mdiag)` corresponds to `setdiagonal( setupper(ma, ml), mdiag)`.

See also
  `diag`, `diagonal`, `diagonalize`, `lower`, `upper`

## shape

    shape(const ma, const r, const c);

`ma`
  in: arithmetic type
`r`
  in: int
`c`
  in: int

Return value
  Returns an `r` by `c` matrix, filled by column from vec(`ma`). If there are fewer than `rc` elements in `ma`, the value 0 is used for padding.
See also
  `reshape`, `vec`

## sin, sinh

    sin(const ma);

`ma`
  in: arithmetic type

Return value
  `sin` returns the sine of `ma`, of double or matrix type.

  `sinh` returns the sine hyperbolicus of `ma`, of double or matrix type.

See also
  `acos`, `asin`, `atan`, `cos`, `cosh`, `sinh`, `tan`, `tanh`

## sizec sizeof sizer sizerc

    sizec(const ma);
    sizeof(const ma);
    sizer(const ma);
    sizerc(const ma);

Return value
  Returns an integer value which is the number elements in the argument:

                         rows/sizeof  columns   sizer  sizec  sizerc
      int, double             0          0        1      1       1
      m x n matrix            m          n        m      n      mn
      string, length c        c          c        1      c       c
      array, length c         c          c        1      c       c
      file (f format)         r          c        r      c      rc

  `columns`, `rows`

## solveldl

    solveldl(const ml, const md, const mb);

`ml`
  in: m `x` m lower diagonal matrix L, LDL'=A
`md`
  in: 1 `x` m matrix with reciprocals of D
`mb`
  in: m `x` n matrix B, the right-hand side

Return value
  Returns the m `x` n matrix X from solving AX=B.
See also
  `decldl`, `invertsym`

## solveldlband

    solveldlband(const ml, const md, const mb);

`ml`
  in: p `x` n vector specifying the Lb matrix
`md`
  in: 1 `x` m matrix with reciprocals of D
`mb`
  in: m `x` n matrix B, the right-hand side

Return value
  Returns the m `x` n matrix X from solving AX=B.
See also
  `decldlband`, `solvetoeplitz`

## solvelu

    solvelu(const ml, const mu, const mp, const mb);

`ml`
  in: m `x` m lower diagonal matrix L
`mu`
  in: m `x` m upper diagonal matrix U
`mp`
  in: 2 `x` m matrix with interchange permutations in the second row
`mb`
  in: m `x` n matrix B, the right-hand side

Return value
  Returns the m `x` n matrix X from solving AX=B.
Description
  Solves AX=B for X following a LU decomposition of A. This function may be used to only do the forward or backward substitution part:
  `solvelu(L, 0, 0, B)` solves LX=B,
  `solvelu(0, U, 0, B)` solves UX=B. So can be used to invert a triagonal matrix.
See also
  `declu`, `invert`

## solvetoeplitz

    solvetoeplitz(const mr, const cm, const mb);
    solvetoeplitz(const mr, const cm, const mb, alogdet);

`mr`
  in: double, or r `x` 1 or 1 `x` r matrix, specifying the positive definite (band) Toeplitz matrix
`cm`
  in: dimension of complete Toeplitz matrix: m `x` m, m >= r
`mb`
  in: m `x` n matrix B, the right-hand side
`alogdet`
  in: (optional argument) address of variable
  out: double, the logarithm of (the absolute value of) the determinant of A

Return value
  Returns the m `x` n matrix X from solving AX=B, or 0 if the Toeplitz matrix is singular.
See also
  `pacf`, `toeplitz`

## sortbyc, sortbyr

    sortbyc(const ma, const icol);
    sortbyr(const ma, const irow);

`ma`
  in: matrix
`icol`
  in: scalar: index of column to sort, or matrix: specifying the columns to sort by.
`irow`
  in: index of row to sort

Return value
  The reordered (sorted in ascending order) matrix.
See also
  `reversec`, `reverser`, `sortc`, `sortr`

## sortc, sortcindex, sortr

    sortc(const ma);
    sortr(const ma);
    sortcindex(const mb);

`ma`
  in: matrix, array or string
`mb`
  in: row vector, column vector, array or string

Return value
  If `ma` is a matrix, the return value is `ma` with each column (`sortc`) or row (`sortr`) sorted in ascending order. If `ma` is scalar the return type and value are that of `ma`.
  If `ma` is an array of strings, the strings are sorted in increasing order (all non-string entries are pushed to the end, and will be in reverse order). If `ma` is a string, the string is returned unchanged.

  `sortcindex` returns a column vector with the sorted index which results from applying `sortc(mb)`; a matrix argument to `sortcindex` must be a column or row vector.

See also
  `sortbyc`, `sortbyr`

## spline

    spline(const my, const mx, const alpha);
    spline(const my, const mx, const alpha, agcv);

`my`
  in: T `x` n matrix with variables (observations in columns) to smooth
`mx`
  in: 0 for evenly spaced Y, else T `x` m matrix with X (where m=1: same X used for all Ys, or m=n: corresponding X is used with Y)
`alpha`
  in: double, bandwidth, 0: automatic bandwidth selection using GCV, <0: absolute value is bandwidth, >0: specifies equivalent number of parameters.
`agcv`
  in: (optional) address, returns GCV (generalized cross validation score) and equivalent number of parameters

Return value
  Returns a T `x` n matrix with the smooth from applying the natural cubic spline. The optional `agcv` argument is a 2 `x` n matrix, with the generalized cross validation (GCV) score in the first row, and the equivalent number of parameters in the second.

## sprint

    sprint(const a, ...);

`a`
  in: any type
`...`
  in: any type

Return value
  Returns a string containing the written text, or 0 if the sprint buffer was too small (see `sprintbuffer`).
Description
  Each argument is printed to a string. See `print` for a description of formatting; the `"%m"`, `"%M"`, `"%#m"` and `"%#M"` formats may not be used in `sprint`. The maximum text length is 2048 characters by default. The `sprintbuffer` function can be used to enlarge the buffer size.
See also
  `eprint`, `print`, `sprintbuffer`

## sprintbuffer

    sprintbuffer(const len);

`len`
  in: int

Return value
  Returns 0 of type int.
Description
  Sets the size of the internal sprint buffer. The default is 2048 characters, and this function is only needed if texts of more than 2048 characters will be written using `sprint`.
See also
  `sprint`

## sqr, sqrt

    sqr(const ma);
    sqrt(const ma);

`ma`
  in: arithmetic type

Return value
  `sqrt` returns the square root of the elements of `ma`, of double or matrix type.

  `sqr` returns the square of the elements of `ma`. If the input to `sqr` is a double or matrix, the return type is a double or matrix. If the input is an integer, the return type is integer unless the result would overflow in integer computation. In that case the return type is double in order to represent the result.

See also
  `pow`, `^ .^`

## sscan

    sscan(const string, const a, ...);
    sscan(const astring, const a, ...);

`string`
  in: string to scan from
`astring`
  in: address of string to scan from, on return the scanned text has been removed from the string
`a`
  in: any type
`...`
  in: any type

Return value
  Returns the number of arguments successfully scanned and assigned. If `s` is a string, then `sscan(s, ...)` will leave the string unchanged, whereas `sscan(&s, ...)` will remove the read characters from the string. Returns $-1$ when at the end of the string.
Description
  This function works as `fscan`, but reading from a string, not a file. See `fscan` for a description of formatting; the `"%m"`, `"%M"`, `"%#m"` and `"%#M"` formats may not be used in `sscan`.
See also
  `fscan`, `fwrite`, `scan`

## standardize

    standardize(const ma);

`ma`
  in: T `x` n matrix A

Return value
  Returns a T `x` n matrix holding the standardized columns of `ma`. If any variance is <= 1e-20, then the corresponding column is set to 0.
See also
  `meanc`, `meanr`, `varc`, `varr`, `variance`

## string

    string(const ma);

`ma`
  in: arithmetic type

Return value
  Casts the argument to a string, see explicit type conversion.
See also
  `double`

## strfind, strfindr, strifind strifindr

    strfind(const where, const what);
    strfindr(const where, const what);
    strifind(const where, const what);
    strifindr(const where, const what);

`where` | `what` | return type
array of strings | array of c string | 1 `x` c matrix with indices of occurrence (-1 if not found)
array of strings | string | int: index of occurrence of string `what`, or -1 if not found
string | string | int: index of occurrence of substring `what`, or -1 if not found
string | r `x` c matrix with character values | 1 `x` rc matrix with indices of occurrence (-1 if not found)
string | character | int: index of occurrence of character `what`, or -1 if not found

`strfind` | case sensitive search
`strifind` | case insensitive search
`strfindr` | case sensitive reverse search
`strifindr` | case insensitive reverse search

## strlwr, strupr

    strlwr(const s);
    strupr(const s);

`s`
  in: the strings to convert

Return value
  Returns a copy of the string, which is converted to lower case (`strlwr`) or uppercase (`strupr`).

## submat

    submat(const ma, const r1, const r2, const c1, const c2);

`ma`
  in: matrix
`r1`,`r2`
  in: int
`c1`,`c2`
  in: int

Return value
  Returns the submatrix of `ma` from row indices `r1` to `r2` and column indices `c1` to `c2`. This is equivalent to `ma[r1:r2][c1:c2]`.
See also
  `submat`, `[]`

## sumc, sumr

    sumc(const ma);
    sumr(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `sumc` function returns a 1 `x` n matrix `r` which holds the sum of the column elements of `ma`.

  The `sumr` function returns a T `x` 1 matrix which holds the sum of the row elements of `ma`.

See also
  `meanc`, `meanr`, `prodc`, `prodr`, `sumsqrc`, `sumsqrr`, `varc`, `varr`

## sumsqrc, sumsqrr

    sumsqrc(const ma);
    sumsqrr(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `sumsqrc` function returns a 1 `x` n matrix `r` which holds the sum of the squares of the column elements of `ma`.

  The `sumsqrr` function returns a T `x` 1 matrix which holds the sum of the squares of the row elements of `ma`.

See also
  `sumc`, `sumr`, `varc`, `varr`

## systemcall

    systemcall(const s);

`s`
  in: system command

Return value
  Performs a operating system call, and waits for the call to finish. Returns the exit code from the system call.
See also
  `chdir`, `getcwd`

## tailchi, tailf, tailn, tailt

    tailchi(const ma, const df);
    tailf(const ma, const df1, const df2);
    tailn(const ma);
    tailt(const ma, const idf);

`ma`
  in: arithmetic type
`df`
  in: arithmetic type, degrees of freedom
`df1`
  in: arithmetic type, degrees of freedom in the numerator
`df2`
  in: arithmetic type, degrees of freedom in the denominator
`idf`
  in: int, degrees of freedom

Return value
  Returns the requested tail probabilities at `ma` (the returned tail probabilities are between zero and one):
  - `tailchi`: tail probabilities from chi2(df) distribution,
  - `tailf`: tail probabilities from F(df1, df2) distribution,
  - `tailn`: one-sided standard normal tail probability,
  - `tailt`: one-sided tail probabilities from student-t(df) distribution.

  The tail probabilities are accurate to about 10 digits. The return type is derived as follows:

  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest is scalar (int for `tailt`);
  - m `x` n matrix, when `ma` is a scalar, and the rest are m `x` n matrices;
  - m `x` n matrix, when `ma` is an m `x` n matrix, and the rest are m `x` n matrices;
  - double, when `ma` is scalar, and the rest is also scalar (int for `tailt`).
See also
  `dens...`, `prob...`, `quan...`

## tan, tanh

    tan(const ma);
    tanh(const ma);

`ma`
  in: arithmetic type

Return value
  `tan` returns the tangent of `ma`, of double or matrix type.

  `tanh` returns the tangent hyperbolicus of `ma`, of double or matrix type.

See also
  `acos`, `asin`, `atan`, `cos`, `cosh`, `sin`, `sinh`, `tanh`

## thinc, thinr

    thinc(const ma, const c);
    thinr(const ma, const r);

`ma`
  in: m `x` n matrix A
`c`
  in: int, desired number of columns to extract
`r`
  in: int, desired number of rows to extract

Return value
  The `thinc` function returns an m by `c` matrix consisting of a selection of columns of the original matrix. The `thinr` function returns an `r` by n matrix consisting of a selection of rows of the original matrix.
See also
  `aggregatec`, `aggregater`

## time

    time();

Return value
  A string holding the current time.
See also
  `date`

## timer, timespan

    timer();
    timespan(const time);
    timespan(const time, const time0);

`time`
  in: double, value from previous call to `timer`
`time0`
  in: double, (optional argument) start time

Return value
  The `timer` function returns a double representing the current time in one 100th of a second.

  The `timespan` function returns a string holding the time lapsed since the `time` argument.

  The `timespan(time, time0)` function returns a string holding the lapsed time between `time` and `time0`. Both arguments must be measured in one 100th of a second.

## timestr, timing, today

    timestr(const time);
    timing(const mdates);
    timing(const mtimes, 1);
    today();

`time`
  in: double, date expressed as number of seconds since 1 January 1970 at 00:00:00 (e.g. a value from `timing`)
`mdates`
  in: T `x` k matrix with date and time, in order: year, month, day, hour, minute, second (see below).
`mtimes`
  in: m `x` n matrix with dates expressed as number of seconds since 1 January 1970 at 00:00:00.

Return value
  The `timing` function returns a T `x` 1 matrix with the date/time expressed as the number of seconds since 1 January 1970 at 00:00:00.

  The two argument `timing` function returns a mn `x` 6 matrix with respectively year, month, day, hour, min, sec in the columns.

  The `timstr` function returns the date/time expressed as a text string: `"year-month-day hour:min:sec"`. The time part is omitted if it is all zero.

  The `today` function returns a double with the current date/time expressed as the number of seconds since 1 January 1970 at 00:00:00.

Description
  The input matrix for `timing` has a specified data and time in each row, with the columns organized as:

      column   item    values
      0        year    full year (e.g. 1970)
      1        month   month in year, 1 ... 12 (e.g. 2 for February)
      2        day     day in month, 1 ... 31
      3        hour    hour in day, 0 ... 23
      4        min     minutes, 0 ... 60
      5        sec     seconds, 0 ... 60

  The actual input matrix may have fewer columns, in which case the remainder is assumed to be zero.

## toeplitz

    toeplitz(const ma);
    toeplitz(const ma, const cm);

`ma`
  in: double, or r `x` 1 or 1 `x` r matrix
`cm`
  in: (optional argument) m: dimension of matrix to be created, m >= r; if the argument is missing, m=r is used.

Return value
  Returns a symmetric Toeplitz matrix.
See also
  `diag`, `solvetoeplitz`

## trace

    trace(const ma);

`ma`
  in: arithmetic type

Return value
  Returns the trace of `ma` (the sum of its diagonal elements). Return type is double.
See also
  `determinant`

## trunc, truncf

    trunc(const ma);
    truncf(const ma);

`ma`
  in: arithmetic type

Return value
  `trunc` returns the truncated elements of `ma`, of double or matrix type.

  `truncf` is fuzzy truncation.

See also
  `ceil`, `floor`, `fuzziness`, `round`,

## unique

    unique(const ma);

`ma`
  in: matrix

Return value
  Returns the sorted unique elements of `ma` as a row vector. Returns an empty matrix if the result is empty. Missing values are skipped.
See also
  `exclusion`, `intersection`

## unit

    unit(const rc);
    unit(const r, const c);

`rc`
  in: int
`r`
  in: int
`c`
  in: int

Return value
  Returns an `rc` by `rc` identity matrix (one argument), or an `r` by `c` matrix with ones on the diagonal (rest zero).
See also
  `constant`, `unit`, `zeros`

## unvech

    unvech(const va);

`va`
  in: arithmetic type, (column or row) vector to make into symmetric matrix

Return value
  Returns a symmetric matrix, given the vectorized lower diagonal of a symmetric matrix.
See also
  `vech`

## upper

    upper(const ma);

`ma`
  in: m `x` n matrix

Return value
  Returns the upper diagonal (including the diagonal), i.e. returns a copy of the input matrix with strict lower-diagonal elements set to zero.
See also
  `lower`, `setdiagonal`, `setlower`, `setupper`

## va_arglist

    va_arglist();

Return value
  Returns an array holding the arguments starting with the first variable in the varieble argument list.
Description
  See variable arguments.

## varc, varr

    varc(const ma);
    varr(const ma);

`ma`
  in: T `x` n matrix A

Return value
  The `varc` function returns a 1 `x` n matrix holding the variances of the columns of `ma`.

  The `varr` function returns a T `x` 1 matrix holding the variances of the rows of `ma`.

See also
  `meanc`, `meanr`, `sumc`, `sumr`, `variance`

## variance

    variance(const ma);

`ma`
  in: T `x` n matrix A

Return value
  Returns an n `x` n matrix holding variance-covariance matrix of `ma`.
See also
  `acf`, `correlation`, `meanc`, `meanr`, `standardize`, `varc`, `varr`

## vec

    vec(const ma);

`ma`
  in: arithmetic type

Return value
  If `ma` is an m `x` n matrix, the return value is an mn `x` 1 matrix consisting of the stacked columns of `ma`. If `ma` is scalar, the return value is an 1 `x` 1 matrix consisting of the value `ma`.
See also
  `shape`, `vech`, `vecr`

## vech

    vech(const ma);

`ma`
  in: arithmetic type

Return value
  If `ma` is an m `x` n matrix, the return value is an (m(m+1)/2 - j(j+1)/2) by 1 matrix, where j = max(m-n,0), consisting of the stacked columns of the lower diagonal of `ma`. If `ma` is scalar, the return value is a 1 `x` 1 matrix consisting of the value `ma`.
See also
  `unvech`, `vec`, `vecr`

## vecindex

    vecindex(const ma);
    vecindex(const ma, const mfind);

`ma`
  in: matrix
`mfind`
  in: matrix (optional argument)

Return value
  `vecindex` with 1 argument returns a p `x` 1 matrix holding the row index of the non-zero elements of vec(`ma`), where p is the number of non-zero elements in `ma`. If there is no non-zero element, the function returns the empty matrix.
  `vecindex` with 2 arguments returns a p `x` 1 matrix holding the row indices of the elements of vec(`ma`), which appear in vec(`mfind`). If none are found, the function returns the empty matrix.
See also
  `shape`, `vec`, `vecrindex`

## vecr

    vecr(const ma);

`ma`
  in: arithmetic type

Return value
  If `ma` is an m `x` n matrix, the return value is an mn `x` 1 matrix consisting of the stacked transposed rows of `ma`. If `ma` is scalar, the return value is a 1 `x` 1 matrix consisting of the value `ma`.
See also
  `reshape`, `vech`, `vec`

## vecrindex

    vecrindex(const ma);
    vecrindex(const ma, const mfind);
    vecrindex(const ma, const mfind, const bunique);

`ma`
  in: matrix
`mfind`
  in: matrix (optional argument)
`bunique`
  in: matrix (optional argument when `mfind` is present)

Return value
  `vecrindex` with 1 argument returns a p `x` 1 matrix holding the row index of the non-zero elements of vecr(`ma`), where p is the number of non-zero elements in `ma`. If there is no non-zero element, the function returns the empty matrix.
  `vecrindex` with 2 arguments returns a p `x` 1 matrix holding the row indices of the elements of vecr(`ma`), which appear in `mfind`. In this case, the optional third argument may be used to only report the first occurrence in `ma`. If none are found, the function returns the empty matrix.
See also
  `vecr`, `vecrindex`

## zeros

    zeros(const r, const c);
    zeros(const ma);

`r`
  in: int
`c`
  in: int
`ma`
  in: matrix

Return value
  `zeros(r,c)` returns an `r` by `c` matrix filled with zeros.
  `zeros(ma)` returns a matrix of the same dimension as `ma`, filled with zeros.
See also
  `ones`, `unit`, `zeros`

Ox version 3.00. © JA Doornik This file last changed
.