In the past
weeks I worked on implementing the chol/qz and matrix/vector flags. My work can
be found at my repository:

#### Calling forms

#### chol/qz flag

In case of
a generalized eigenvalue problem the chol/qz flag can be used in Matlab. The
aim of this task was to introduce this functionality to Octave.

The chol/qz
flag only matters if your matrices are symmetric as:

Regardless
of the algorithm you specify, the eig function always uses the QZ algorithm
when A or B are not symmetric. [1]

If you omit
the chol/qz flag it works as it worked before:

**The algorithm used depends on whether**there are one or two input matrices, if they are real or complex, and if

**they are symmetric (Hermitian if complex) or non-symmetric.**[2]

Which is
the same as in Matlab:

When
you omit the algorithm argument, the eig function selects an algorithm based on
the properties of A and B. It uses the 'chol' algorithm for symmetric
(Hermitian) A and symmetric (Hermitian) positive definite B. Otherwise, it uses
the 'qz' algorithm. [1]

So if it is
a symmetric problem than the chol method is used otherwise the qz method is
used.

#### matrix/vector flag

The
matrix/vector flag can be used in every previous call forms. With it you can
specify the format of the eigenvalues.

If you use the
“vector” flag the eigenvalues will be returned in a column vector.

If you use
the “matrix” flag the eigenvalues will be returned in a diagonal matrix.

If you omit
this flag than the eigenvalues will be returned in the same format as before,
which is the same as in Matlab:

The
default behavior varies according to the number of outputs specified:

If
you specify one output, such as e = eig(A), then the eigenvalues are returned
as a column vector by default.

If
you specify two or three outputs, such as [V,D] = eig(A), then the eigenvalues
are returned as a diagonal matrix, D, by default. [3]

[1] http://www.mathworks.com/help/matlab/ref/eig.html#inputarg_algorithm

## No comments:

## Post a Comment