Contents - Index


ABSOLUTE - Syntax: abs(<mat>).
Takes the absolute value of every value in <mat>.  May be abbreviated to "ABS".  Example:

junk = abs(a:\atlanta\corrmat)

ARCTAN - Syntax: arc(<mat>).  Takes the arctangent of each value in <mat>.  Example:

junk = arc(a:\atlanta\corrmat)

COMMON LOG - Syntax: log10(<mat>).  Takes the base 10 logarithm of each value of the argument.  Example:

junk = log10(a:\atlanta\corrmat)

COSINE - Syntax: cos(<mat>).  Takes the cosine of each value in <mat>.  Example:

junk = cos(a:\atlanta\corrmat)

EXPONENT - Syntax: exp(<mat>).  Raises e (the base of natural logarithms) to the power given by each cell of the argument.  Example:

junk = exp(a:\atlanta\corrmat)

FILL - Syntax: fill(<mat>,<nr>,<nc>).  Expands the matrix in <mat> to the dimensions given by <nr> and <nc> by duplicating values.  For example, given matrix X, 
  1  2  3
X = 4  5  6
  7  8  9

the command

  y = fill(x,5,6)

  1  2  3  1  2  3
  4  5  6  4  5  6
Y = 7  8  9  7  8  9
  1  2  3  1  2  3
  4  5  6  4  5  6

GENERALISED INVERSE - Syntax: ginv(<mat>).  Given a dataset <mat> containing a matrix X (with at least as many rows as columns), the function computes the inverse X^-1 such that XX^-1 = I, where I is the identity matrix, based on a reduced rank representation of the matrix.
junk = ginv(corrmat)

GEODESIC DISTANCES - Syntax: dist(<adjmat>).  Given an adjacency matrix, it generates the geodesic distance matrix. Example:

pathlenghts = dist(campnet)

IDENTITY - Syntax: id(<n>).  Generates an identity matrix with <n> rows and columns.  Example:

i = id(100)

INVERSE - Syntax: inv(<sqmat>).  Generates the inverse of the square matrix, if it exists.   Example:

cninverse = inv(campnet)

Usually, however, the generalized inverse is preferred.  


LINEAR - Syntax: lin(<mat>,<real>,<real>).  Given a data set containing a matrix then the function performs a linear transformation on every cell value.  If a cell value was x then the function forms real 1x + real 2.  If real 2 is omitted then it is assumed to be zero.  Example:
junk = lin(a:\atlanta\corrmat,3.2,4)

creates a new matrix junk which has each cell transformed by multiplying by 3.2 and adding 4.
MATRIX - Syntax: mat(<real>[,<numrows>][,<numcols>],[<num1evels>]).  Converts a number into a matrix, or creates a matrix of constants.  If any of <nr>, <nc>, and <n1> are not specified, the default value is 1.  To specify <n1>, you must specify <nr> and <nc> as well. Examples:

junk = mat(3.92) {creates 1-by-1 matrix with all values 3.92}
junk = mat(4,10,10) {creates 10-by-10 matrix containing only 4s}
junk = mat(4,10,10,2) {creates 10-by-10-by-2 matrix containing only 4s}

This function is useful in conjunction with other functions for cellwise manipulations of a matrix.  For example,

junk = add(freqs,mat(0.01,8,10))

adds the constant 0.01 to every cell of the 8-by-10 matrix contained in freqs.

NATURAL LOG - Syntax: log(<mat>) or ln(<mat>).  Takes the natural logarithm of each value of the argument.  Examples:

junk = log(a:\atlanta\corrmat)
junk = ln(a:\atlanta\corrmat)

NEGATIVE - Syntax: neg(<mat>).  Multiplies each value of <mat> by -1.  Example:

revcorr = neg(a:\atlanta\corrmat)

RANDOM - Syntax: newds = random([nrows ,[ncols, [nlevels, [normal]]]]).  Actually a function, this creates a new dataset (in this case newds) with nrows rows and ncols.  The nlevels parameter is optional, and specifies the number of levels in the matrix.  By default, it is 1.  The normal parameter (which is the word "normal") is also optional, although the nlevels parameter must be specified if normal is used.  If present, the normal parameter delivers random numbers from a normal distribution, otherwise they are from a uniform distribution (i.e., every number is equally likely).  

newds = random(3,7) <= creates a new dataset called newds with 3 rows and 7 columns.
newnorm = random(5,5,1,normal)  <= creates a new dataset of normally distributed values called newnorm with 5 rows and columns.

RECIPROCAL - Syntax: recip(<mat>).  Takes the reciprocal of each element.  Example:

junk = rec(a:\atlanta\corrmat)

ROTATE - Syntax: rotate(<mat>,[ V | Q ] ).  Rotate the matrix specified in the first argument according to the method specified in the second (V=varimax, Q=quartermax).  The second parameter is not required and the rotation defaults to varimax if not specified.  Example:

orth = rotate(factors,V)

ROUND - Syntax: round(<mat>) or rnd(<mat>).  Rounds each value of <mat> to the nearest integer.  Example:

junk = rnd(a:\atlanta\corrmat)

SINE - Syntax: sin(<mat>).  Computes sine of each value in <mat>.Example:

junk = sin(a:\atlanta\corrmat)

SQUARE - Syntax: sqr(<mat>).  Computes square of each value in <mat>.  Example:

junk = sqr(a:\atlanta\corrmat)

SQUARE ROOT - Syntax: sqrt(<mat>).  Computes square root of each value in <mat>.  Example:

junk = sqrt(a:\atlanta\corrmat)

TRUNCATE - Syntax: trunc(<mat>) or trunc(<mat>).  Rounds each value of <mat> down to the largest whole number contained by the value.  Example:

junk = trunc(a:\atlanta\corrmat)


Binary Operations

Uniary Operations


Matrix Algebra