Admin Production ni-theme
Current Publication

GenEigenValueVector

LabWindows/CVI

GenEigenValueVector

Advanced Analysis Library Only

AnalysisLibErrType GenEigenValueVector (void *inputMatrix, ssize_t matrixSize, int outputChoice, NIComplexNumber eigenvalues[], void *eigenvectors);

Purpose

Calculates the eigenvalues λ and the corresponding eigenvectors x of a real, square input matrix. The following formula defines the eigenvalues and the corresponding eigenvectors:

Ax = λx

Although the input matrix is real, the eigenvalues and the eigenvectors can be complex if the matrix is not symmetric.

The outputChoice parameter determines what to calculate. Depending on your application, you can choose to calculate just the eigenvalues or to calculate both the eigenvalues and the eigenvectors.

The eigenValues output parameter is a 1D, complex array of matrixSize elements. The input matrix can have complex eigenvalues if it is not symmetric.

The eigenVectors output parameter is an matrixSize-by-matrixSize, complex matrix (2D array). Each ith column of this matrix is the eigenvector that corresponds to the ith component of the eigenValues. Each eigenvector is normalized so that its largest component equals one. The input matrix can have complex eigenvectors if it is not symmetric.

Parameters

Input
Name Type Description
inputMatrix void * Input square matrix. This matrix must be an array of doubles. This matrix will be overwritten; you must make a copy of the input matrix if you want to use it later.
matrixSize ssize_t Number of elements in one dimension of the input matrix.
outputChoice int Specifies whether the function computes eigenvectors. Specify one of the following values:
  • 0: compute only eigenvalues of inputMatrix.
  • 1: compute both eigenvalues and eigenvectors of inputMatrix.
Output
Name Type Description
eigenvalues NIComplexNumber [] Resulting eigenvalues of inputMatrix. The following C typedef statement defines the ComplexNum structure:

typedef struct {

double real;

double imaginary;

} ComplexNum;

eigenvectors void * Resulting eigenvectors of inputMatrix. You can pass NULL if outputChoice is 0.

Return Value

Name Type Description
status AnalysisLibErrType A value that specifies the type of error that occurred. Refer to analysis.h for definitions of these constants.

Additional Information

Library: Advanced Analysis Library

Include file: analysis.h

LabWindows/CVI compatibility: LabWindows/CVI 5.0 and later