search.cpan.org is shutting down
Ralph Schleicher > Math-MatrixDecomposition > Math::MatrixDecomposition::Eigen

Math-MatrixDecomposition-1.03.tar.gz

Dependencies

Annotate this POD

CPAN RT

 New 1 Open 0
View/Report Bugs
Module Version: 1.03

NAME

Math::MatrixDecomposition::Eigen - eigenvalues and eigenvectors

SYNOPSIS

Object-oriented interface.

```    use Math::MatrixDecomposition::Eigen;

\$eigen = Math::MatrixDecomposition::Eigen->new;
\$eigen->decompose (\$A = [...]);

# Decomposition is the default action for 'new'.
# This one-liner is equivalent to the command sequence above.
\$eigen = Math::MatrixDecomposition::Eigen->new (\$A = [...]);```

The procedural form is even shorter.

```    use Math::MatrixDecomposition qw(eig);

\$eigen = eig (\$A = [...]);```

DESCRIPTION

Object Instantiation

`eig` (...)

The `eig` function is the short form of `Math::MatrixDecomposition::Eigen->new` (which see). The `eig` function has to be used as a subroutine. It is not exported by default.

`new` (...)

Create a new object. Any arguments are forwarded to the `decompose` method (which see). The `new` constructor can be used as a class or instance method.

Instance Methods

`decompose` (a, m, n, ...)

Calculate eigenvalues and eigenvectors of a real matrix.

• First argument a is an array reference to the matrix elements. Matrix elements are interpreted in row-major layout.
• Optional second argument m is the number of matrix rows. If omitted, it is assumed that the matrix is square.
• Optional third argument n is the number of matrix columns. If omitted, the number of matrix columns is calculated automatically.
• Remaining arguments are property/value pairs with the following meaning.
`balance` flag

Whether or not to balance a non-symmetric matrix a. Default is true.

`normalize` flag

Whether or not to normalize the eigenvectors. Default is true.

`positive` flag

Whether or not to make the first non-zero element of an eigenvector a positive number. Default is true.

Return value is the eigenvalue/eigenvector object.

`normalize`

Normalize the eigenvectors.

Return value is the eigenvalue/eigenvector object.

`sort` (order)

Sort eigenvalues and corresponding eigenvectors or vice versa.

• Argument order is the sorting order (a string). The possible values for order together with their meaning is described in the following table.
`"abs_desc"`

Sort eigenvalues in descending order by first comparing the absolute value of the real part, then the absolute value, then the real part, and finally the imaginary part.

`"abs_asc"`

Sort eigenvalues in ascending order. This is the reverse order of `"abs_desc"`.

`"norm_desc"`

Sort eigenvalues in descending order by first comparing the absolute value, then the real part, and finally the imaginary part. If all eigenvalues are real, this sorting order is equal to `"abs_desc"`.

`"norm_asc"`

Sort eigenvalues in ascending order. This is the reverse order of `"norm_desc"`. If all eigenvalues are real, this sorting order is equal to `"abs_asc"`.

`"desc"`

Sort eigenvalues in descending order by first comparing the real part and then the imaginary part.

`"asc"`

Sort eigenvalues in ascending order. This is the reverse order of `"desc"`.

`"vec_desc"`

Sort eigenvectors in descending order.

`"vec_asc"`

Sort eigenvectors in ascending order.

Return value is the eigenvalue/eigenvector object.

`value` (...)
`values` (...)

Return one or more eigenvalues.

Arguments are one or more indices. If no argument is specified, return all eigenvalues as a list.

If `\$eigen` is a eigenvalues/eigenvectors object, the following expressions are valid use cases of the `value`/`values` method.

```    # Get all eigenvalues.
@all = \$eigen->values;

# Get a single eigenvalue.
\$first = \$eigen->value (0);

# Get multiple eigenvalues.
(\$first, \$last) = \$eigen->values (0, -1);```

Complex eigenvalues are Math::Complex objects.

`vector` (...)
`vectors` (...)

Return one or more eigenvectors.

Arguments are one or more indices. If no argument is specified, return all eigenvectors as a list.

If `\$eigen` is a eigenvalues/eigenvectors object, the following expressions are valid use cases of the `vector`/`vectors` method.

```    # Get all eigenvectors.
@all = \$eigen->vectors;

# Get a single eigenvector.
\$first = \$eigen->vector (0);

# Get multiple eigenvectors.
(\$first, \$last) = \$eigen->vectors (0, -1);```

An eigenvector is a Perl array reference. If you modify the elements of an eigenvector, you modify the elements of the original eigenvector.