# Class EigenOps_DDRM

java.lang.Object
org.ejml.dense.row.EigenOps_DDRM

```public class EigenOps_DDRM
extends Object```
Additional functions related to eigenvalues and eigenvectors of a matrix.
• ## Constructor Summary

Constructors
Constructor Description
`EigenOps_DDRM()`
• ## Method Summary

Modifier and Type Method Description
`static double[]` ```boundLargestEigenValue​(DMatrixRMaj A, @org.jetbrains.annotations.Nullable double[] bound)```
Generates a bound for the largest eigen value of the provided matrix using Perron-Frobenius theorem.
`static double` ```computeEigenValue​(DMatrixRMaj A, DMatrixRMaj eigenVector)```
Given matrix A and an eigen vector of A, compute the corresponding eigen value.
`static @Nullable DEigenpair` ```computeEigenVector​(DMatrixRMaj A, double eigenvalue)```
Given an eigenvalue it computes an eigenvector using inverse iteration:
for i=1:MAX {
(A - μI)z(i) = q(i-1)
q(i) = z(i) / ||z(i)||
λ(i) = q(i)T A q(i)
}
`static DMatrixRMaj` `createMatrixD​(EigenDecomposition_F64<?> eig)`
A diagonal matrix where real diagonal element contains a real eigenvalue.
`static DMatrixRMaj` `createMatrixV​(EigenDecomposition_F64<DMatrixRMaj> eig)`
Puts all the real eigenvectors into the columns of a matrix.
`static @Nullable DEigenpair` `dominantEigenpair​(DMatrixRMaj A)`
Computes the dominant eigen vector for a matrix.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ## Constructor Details

• ### EigenOps_DDRM

public EigenOps_DDRM()
• ## Method Details

• ### computeEigenValue

public static double computeEigenValue​(DMatrixRMaj A, DMatrixRMaj eigenVector)

Given matrix A and an eigen vector of A, compute the corresponding eigen value. This is the Rayleigh quotient.

xTAx / xTx

Parameters:
`A` - Matrix. Not modified.
`eigenVector` - An eigen vector of A. Not modified.
Returns:
The corresponding eigen value.
• ### computeEigenVector

@Nullable public static @Nullable DEigenpair computeEigenVector​(DMatrixRMaj A, double eigenvalue)

Given an eigenvalue it computes an eigenvector using inverse iteration:
for i=1:MAX {
(A - μI)z(i) = q(i-1)
q(i) = z(i) / ||z(i)||
λ(i) = q(i)T A q(i)
}

NOTE: If there is another eigenvalue that is very similar to the provided one then there is a chance of it converging towards that one instead. The larger a matrix is the more likely this is to happen.

Parameters:
`A` - Matrix whose eigenvector is being computed. Not modified.
`eigenvalue` - The eigenvalue in the eigen pair.
Returns:
The eigenvector or null if none could be found.
• ### dominantEigenpair

@Nullable public static @Nullable DEigenpair dominantEigenpair​(

Computes the dominant eigen vector for a matrix. The dominant eigen vector is an eigen vector associated with the largest eigen value.

WARNING: This function uses the power method. There are known cases where it will not converge. It also seems to converge to non-dominant eigen vectors some times. Use at your own risk.

Parameters:
`A` - A matrix. Not modified.
• ### boundLargestEigenValue

public static double[] boundLargestEigenValue​(DMatrixRMaj A, @Nullable @org.jetbrains.annotations.Nullable double[] bound)

Generates a bound for the largest eigen value of the provided matrix using Perron-Frobenius theorem. This function only applies to non-negative real matrices.

For "stochastic" matrices (Markov process) this should return one for the upper and lower bound.

Parameters:
`A` - Square matrix with positive elements. Not modified.
`bound` - Where the results are stored. If null then a matrix will be declared. Modified.
Returns:
Lower and upper bound in the first and second elements respectively.
• ### createMatrixD

public static DMatrixRMaj createMatrixD​(EigenDecomposition_F64<?> eig)

A diagonal matrix where real diagonal element contains a real eigenvalue. If an eigenvalue is imaginary then zero is stored in its place.

Parameters:
`eig` - An eigenvalue decomposition which has already decomposed a matrix.
Returns:
A diagonal matrix containing the eigenvalues.
• ### createMatrixV

public static DMatrixRMaj createMatrixV​(

Puts all the real eigenvectors into the columns of a matrix. If an eigenvalue is imaginary then the corresponding eigenvector will have zeros in its column.

Parameters:
`eig` - An eigenvalue decomposition which has already decomposed a matrix.
Returns:
An m by m matrix containing eigenvectors in its columns.