Next: Matrix Factorizations, Up: Linear Algebra

— Loadable Function: `aa` = **balance** (`a, opt`)

— Loadable Function: [`dd`, `aa`] = **balance** (`a, opt`)

— Loadable Function: [`cc`, `dd`, `aa`, `bb`] = **balance** (`a, b, opt`)

— Loadable Function: [

— Loadable Function: [

`[dd, aa] = balance (a)`

returns`aa = dd \ a * dd`

.`aa`

is a matrix whose row and column norms are roughly equal in magnitude, and`dd`

=`p * d`

, where`p`

is a permutation matrix and`d`

is a diagonal matrix of powers of two. This allows the equilibration to be computed without roundoff. Results of eigenvalue calculation are typically improved by balancing first.

`[cc, dd, aa, bb] = balance (a, b)`

returns`aa = cc*a*dd`

and`bb = cc*b*dd)`

, where`aa`

and`bb`

have non-zero elements of approximately the same magnitude and`cc`

and`dd`

are permuted diagonal matrices as in`dd`

for the algebraic eigenvalue problem.The eigenvalue balancing option

`opt`

is selected as follows:

`"N"`

,`"n"`

- No balancing; arguments copied, transformation(s) set to identity.
`"P"`

,`"p"`

- Permute argument(s) to isolate eigenvalues where possible.
`"S"`

,`"s"`

- Scale to improve accuracy of computed eigenvalues.
`"B"`

,`"b"`

- Permute and scale, in that order. Rows/columns of a (and b) that are isolated by permutation are not scaled. This is the default behavior.
Algebraic eigenvalue balancing uses standard Lapack routines.

Generalized eigenvalue problem balancing uses Ward's algorithm (SIAM Journal on Scientific and Statistical Computing, 1981).

— Function File: **cond** (`a`)

Compute the (two-norm) condition number of a matrix.

`cond (a)`

is defined as`norm (a) * norm (inv (a))`

, and is computed via a singular value decomposition.

— Loadable Function: [`d`, `rcond`] = **det** (`a`)

Compute the determinant of

ausing Lapack. Return an estimate of the reciprocal condition number if requested.

— Function File: **dmult** (`a, b`)

If

ais a vector of length`rows (`

b`)`

, return`diag (`

a`) *`

b(but computed much more efficiently).

— Function File: **dot** (`x, y, dim`)

Computes the dot product of two vectors. If

xandyare matrices, calculate the dot-product along the first non-singleton dimension. If the optional argumentdimis given, calculate the dot-product along this dimension.

— Loadable Function: `lambda` = **eig** (`a`)

— Loadable Function: [`v`, `lambda`] = **eig** (`a`)

— Loadable Function: [

The eigenvalues (and eigenvectors) of a matrix are computed in a several step process which begins with a Hessenberg decomposition, followed by a Schur decomposition, from which the eigenvalues are apparent. The eigenvectors, when desired, are computed by further manipulations of the Schur decomposition.

— Loadable Function: `g` = **givens** (`x, y`)

— Loadable Function: [`c`, `s`] = **givens** (`x, y`)

— Loadable Function: [

Return a 2 by 2 orthogonal matrix

g`= [`

cs`; -`

s`'`

c`]`

such thatg`[`

x`;`

y`] = [*; 0]`

withxandyscalars.For example,

givens (1, 1) => 0.70711 0.70711 -0.70711 0.70711

— Loadable Function: [`x`, `rcond`] = **inv** (`a`)

— Loadable Function: [`x`, `rcond`] = **inverse** (`a`)

— Loadable Function: [

Compute the inverse of the square matrix

a. Return an estimate of the reciprocal condition number if requested, otherwise warn of an ill-conditioned matrix if the reciprocal condition number is small.

— Function File: **norm** (`a, p`)

Compute the p-norm of the matrix

a. If the second argument is missing,`p = 2`

is assumed.If

ais a matrix:

p=`1`

- 1-norm, the largest column sum of the absolute values of
a.p=`2`

- Largest singular value of
a.p=`Inf`

- Infinity norm, the largest row sum of the absolute values of
a.p=`"fro"`

- Frobenius norm of
a,`sqrt (sum (diag (`

a`' *`

a`)))`

.If

ais a vector or a scalar:

p=`Inf`

`max (abs (`

a`))`

.p=`-Inf`

`min (abs (`

a`))`

.- other
- p-norm of
a,`(sum (abs (`

a`) .^`

p`)) ^ (1/`

p`)`

.

— Function File: **null** (`a, tol`)

Return an orthonormal basis of the null space of

a.The dimension of the null space is taken as the number of singular values of

anot greater thantol. If the argumenttolis missing, it is computed asmax (size (a)) * max (svd (a)) * eps

— Function File: **orth** (`a, tol`)

Return an orthonormal basis of the range space of

a.The dimension of the range space is taken as the number of singular values of

agreater thantol. If the argumenttolis missing, it is computed asmax (size (a)) * max (svd (a)) * eps

— Loadable Function: **pinv** (`x, tol`)

Return the pseudoinverse of

x. Singular values less thantolare ignored.If the second argument is omitted, it is assumed that

tol = max (size (x)) * sigma_max (x) * eps,where

`sigma_max (`

x`)`

is the maximal singular value ofx.

— Function File: **rank** (`a, tol`)

Compute the rank of

a, using the singular value decomposition. The rank is taken to be the number of singular values ofathat are greater than the specified tolerancetol. If the second argument is omitted, it is taken to betol = max (size (a)) * sigma(1) * eps;where

`eps`

is machine precision and`sigma(1)`

is the largest singular value ofa.