EigenValuesVectors

Finds eigenvalues, right and left eigenvectors for real general (nonsymmetric) matrices (solves nonsymmetric eigenvalue problem).

Syntax

Case 1: Eigenvalues, right and left eigenvectors for a matrix

IppStatus ippmEigenValuesVectors_m_32f (const Ipp32f* pSrc, int srcStride1, int srcStride2, Ipp32f* pDstVectorsRight, int dstRightStride1, int dstRightStride2, Ipp32f* pDstVectorsLeft, int dstLeftStride1, int dstLeftStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_m_64f (const Ipp64f* pSrc, int srcStride1, int srcStride2, Ipp64f* pDstVectorsRight, int dstRightStride1, int dstRightStride2, Ipp64f* pDstVectorsLeft, int dstLeftStride1, int dstLeftStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_m_32f_P (const Ipp32f** ppSrc, int srcRoiShift, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_m_64f_P (const Ipp64f** ppSrc, int srcRoiShift, Ipp64f** ppDstVectorsRight, int dstRightRoiShift, Ipp64f** ppDstVectorsLeft, int dstLeftRoiShift, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

Case 2: Eigenvalues and right eigenvectors for a matrix

IppStatus ippmEigenValuesVectorsRight_m_32f (const Ipp32f* pSrc, int srcStride1, int srcStride2, Ipp32f* pDstVectorsRight, int dstRightStride1, int dstRightStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_m_64f (const Ipp64f* pSrc, int srcStride1, int srcStride2, Ipp64f* pDstVectorsRight, int dstRightStride1, int dstRightStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_m_32f_P (const Ipp32f** ppSrc, int srcRoiShift, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_m_64f_P (const Ipp64f** ppSrc, int srcRoiShift, Ipp64f** ppDstVectorsRight, int dstRightRoiShift, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

Case 3: Eigenvalues and left eigenvectors for a matrix

IppStatus ippmEigenValuesVectorsLeft_m_32f (const Ipp32f* pSrc, int srcStride1, int srcStride2, Ipp32f* pDstVectorsLeft, int dstLeftStride1, int dstLeftStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_m_64f (const Ipp64f* pSrc, int srcStride1, int srcStride2, Ipp64f* pDstVectorsLeft, int dstLeftStride1, int dstLeftStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_m_32f_P (const Ipp32f** ppSrc, int srcRoiShift, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_m_64f_P (const Ipp64f** ppSrc, int srcRoiShift, Ipp64f** ppDstVectorsLeft, int dstLeftRoiShift, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, Ipp8u* pBuffer);

Case 4: Eigenvalues, right and left eigenvectors for a matrix array

IppStatus ippmEigenValuesVectors_ma_32f (const Ipp32f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp32f* pDstVectorsRight, int dstRightStride0, int dstRightStride1, int dstRightStride2, Ipp32f* pDstVectorsLeft, int dstLeftStride0, int dstLeftStride1, int dstLeftStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_ma_64f (const Ipp64f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp64f* pDstVectorsRight, int dstRightStride0, int dstRightStride1, int dstRightStride2, Ipp64f* pDstVectorsLeft, int dstLeftStride0, int dstLeftStride1, int dstLeftStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_ma_32f_P (const Ipp32f** ppSrc, int srcRoiShift, int srcStride0, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride0, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride0, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_ma_64f_P (const Ipp64f** ppSrc, int srcRoiShift, int srcStride0, Ipp64f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride0, Ipp64f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride0, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_ma_32f_L (const Ipp32f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride1, int dstRightStride2, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride1, int dstLeftStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectors_ma_64f_L (const Ipp64f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride1, int dstRightStride2, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride1, int dstLeftStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

Case 5: Eigenvalues and right eigenvectors for a matrix array

IppStatus ippmEigenValuesVectorsRight_ma_32f (const Ipp32f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp32f* pDstVectorsRight, int dstRightStride0, int dstRightStride1, int dstRightStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_ma_64f (const Ipp64f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp64f* pDstVectorsRight, int dstRightStride0, int dstRightStride1, int dstRightStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_ma_32f_P (const Ipp32f** ppSrc, int srcRoiShift, int srcStride0, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride0, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_ma_64f_P (const Ipp64f** ppSrc, int srcRoiShift, int srcStride0, Ipp64f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride0, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_ma_32f_L (const Ipp32f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp32f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride1, int dstRightStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsRight_ma_64f_L (const Ipp64f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp64f** ppDstVectorsRight, int dstRightRoiShift, int dstRightStride1, int dstRightStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

Case 6: Eigenvalues and left eigenvectors for a matrix array

IppStatus ippmEigenValuesVectorsLeft_ma_32f (const Ipp32f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp32f* pDstVectorsLeft, int dstLeftStride0, int dstLeftStride1, int dstLeftStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_ma_64f (const Ipp64f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp64f* pDstVectorsLeft, int dstLeftStride0, int dstLeftStride1, int dstLeftStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_ma_32f_P (const Ipp32f** ppSrc, int srcRoiShift, int srcStride0, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride0, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_ma_64f_P (const Ipp64f** ppSrc, int srcRoiShift, int srcStride0, Ipp64f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride0, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_ma_32f_L (const Ipp32f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp32f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride1, int dstLeftStride2, Ipp32f* pDstValuesRe, Ipp32f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

IppStatus ippmEigenValuesVectorsLeft_ma_64f_L (const Ipp64f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp64f** ppDstVectorsLeft, int dstLeftRoiShift, int dstLeftStride1, int dstLeftStride2, Ipp64f* pDstValuesRe, Ipp64f* pDstValuesIm, int widthHeight, int count, Ipp8u* pBuffer);

Parameters

pSrc, ppSrc
Pointer to the source matrix or array of matrices.
srcStride0
Stride between matrices in the source array.
srcStride1
Stride between rows in the source matrix(ces).
srcStride2
Stride between elements in the source matrix(ces).
srcRoiShift
ROI shift in the source matrix(ces).
pDstVectorsRight,
ppDstVectorsRight
Pointer to the destination matrix or array of matrices whose columns are right eigenvectors. The size of each matrix must be at least equal to widthHeight* widthHeight. See eigenvectors storage features in the Description subsection.
dstRightStride0
Stride between matrices in the destination matrix array of right eigenvectors.
dstRightStride1
Stride between rows in the destination matrix of right eigenvectors.
dstRightStride2
Stride between elements in the destination matrix of right eigenvectors.
dstRightRoiShift
ROI shift in the destination matrix of right eigenvectors.
pDstVectorsLeft,
ppDstVectorsLeft
Pointer to the destination matrix or array of matrices whose columns are left eigenvectors. The size of each matrix must be at least equal to widthHeight* widthHeight. See eigenvectors storage features in the Description below.
dstLeftStride0
Stride between matrices in the destination matrix array of left eigenvectors.
dstLeftStride1
Stride between rows in the destination matrix of left eigenvectors.
dstLeftStride2
Stride between elements in the destination matrix of left eigenvectors.
dstLeftRoiShift
ROI shift in the destination matrix of left eigenvectors.
pDstValuesRe
Pointer to the destination dense array containing real parts of eigenvalues. The number of elements in the array must be at least equal to widthHeight for a matrix or widthHeight*count for an array of matrices. Note that for a complex conjugate pair of eigenvalues, the real part is stored in the array twice.
pDstValuesIm
Pointer to the destination dense array containing imaginary parts of eigenvalues. The number of elements in the array must be at least equal to widthHeight for a matrix or widthHeight*count for an array of matrices. Note that in a complex conjugate pair of eigenvalues, the positive imaginary part is stored in the array first.
widthHeight
Size of the source square matrix (matrices).
count
The number of matrices in the array.
pBuffer
Pointer to the allocated buffer used for internal computations. You should compute the buffer size using the function EigenValuesVectorsGetBufSize prior to calling ippmEigenValuesVectors.

Description

The function ippmEigenValuesVectors is declared in the ippm.h header file.

Given a real general (nonsymmetric) square matrix A of size widthHeight*widthHeight, the function finds eigenvalues λ, right and left eigenvectors, such that

where zH is the conjugate transpose of z.

Real nonsymmetric matrices may have complex eigenvalues. If a real nonsymmetric matrix has a complex eigenvalue a+ib, then a-ib is also an eigenvalue (i is the imaginary unit.).

Real parts of eigenvalues are stored densely in the array pointed by pDstValuesRe. and the imaginary parts are stored in the same order densely in the array pointed by pDstValuesIm. For a complex conjugate pair of eigenvalues, the real part is stored twice and imaginary parts are stored one after another, the positive one being stored first.

Eigenvectors are stored in the same order as the corresponding eigenvalues in the matrix(ces) pointed by pDstVectorsLeft ( ppDstVectorsLeft) or pDstVectorsRight ( ppDstVectorsRight). If the eigenvalue λ( j) is real, then the j-th column v(j) of the storage matrix contains the corresponding real eigenvector z( j). If the eigenvalues λ( j) and λ(j+1) make up a complex conjugate pair, the respective columns of the storage matrix do not directly contain the eigenvectors. However, the respective eigenvectors, which also make up the complex conjugate pair, can be obtained from the matrix columns v(j) and v(j+1) as follows:

z(j) = v(j) + i*v(j+1) and z(j+1) = v(j) - i*v(j+1), where i is the imaginary unit.

The number of eigenvectors may be less than the matrix order and is equal to the number of different eigenvalues.

The eigenvectors are normalized using the Euclidean norm:



In case of complex eigenvectors, the complex rotation is also applied to make the largest component real.

When all eigenvalues and eigenvectors are computed, the classical spectral factorization of A is

and L is a diagonal matrix whose elements are the eigenvalues.

If the number of different eigenvalues is equal to the matrix order, then the matrix A has linearly independent eigenvectors. In this case, LH = R-1, so the spectral factorization of A is A = RΛLH.

To solve a nonsymmetric eigenvalue problem, first a matrix is reduced to the upper Hessenberg form. Then the eigenvalues and eigenvectors are computed with the Hessenberg matrix obtained using the QR algorithm.

If the QR algorithm has not converged in a given number of iterations, the function returns status ippStsCountMatrixErr (see Return Values).

However the calculations continue for the remaining 3D vectors in the source array.

The following example demonstrates how to use the function ippmEigenValuesVectors_m_32f. For more information, see also examples in Getting Started.

ippmEigenValuesVectors_m_32f

IppStatus EigenValuesVectors_m_32f (void) {
    /* Source data: matrix with width=4 and height=4 */
    Ipp32f pSrc[4*4]= {1, 1, 1, 3,
                       2, 1, 3, 1,
                       3, 2, 0, 1,
                       1, 3, 1, 3};
 
    int widthHeight=4;
 
    int srcStride1 = 4*sizeof(Ipp32f);
    int srcStride2 = sizeof(Ipp32f);
 
    Ipp32f pDstVectorsRight[4*4]; /* Right Eigenvectors location */
    Ipp32f pDstVectorsLeft[4*4];  /* Left  Eigenvectors location */
 
    int dstRightStride1 = 4*sizeof(Ipp32f);
    int dstRightStride2 = sizeof(Ipp32f);
    int dstLeftStride1  = 4*sizeof(Ipp32f);
    int dstLeftStride2  = sizeof(Ipp32f);
 
    Ipp32f pDstValuesRe[4]; /* Real parts Eigen values location      */
 
    Ipp32f pDstValuesIm[4]; /* Imaginary parts Eigen values location */
 
 
    Ipp8u* pBuffer; /* Pointer to the buffer */
    int SizeBytes;  /* Size of the buffer should be specified */
 
    IppStatus status;
 
    /* It is required to get the buffer size */
    status=ippmEigenValuesVectorsGetBufSize_32f(widthHeight, &SizeBytes);
 
    /* It is required to allocate the buffer of SizeBytes size */
    pBuffer=ippsMalloc_8u(SizeBytes);
 
    /* Call EigenValuesVectors function */
    status=ippmEigenValuesVectors_m_32f((const Ipp32f*)pSrc,
        srcStride1, srcStride2, pDstVectorsRight, dstRightStride1,
        dstRightStride2, pDstVectorsLeft, dstLeftStride1, dstLeftStride2,
        pDstValuesRe, pDstValuesIm, widthHeight, pBuffer);
 
    ippsFree(pBuffer);
 
    /*
    // It is required for EigenValuesVectors function to check return status 
    // for catching wrong result in case of invalid input data
    */
    if (status == ippStsOk) {
 
        printf_m_Ipp32f("Right Eigenvectors matrix:", pDstVectorsRight, 4, 4,
             status);
        printf_m_Ipp32f("Left Eigenvectors matrix:", pDstVectorsLeft, 4, 4,
             status);
 
        printf_va_Ipp32f("Eigenvalues real parts:", pDstValuesRe, 4, 1,
            status);
        printf_va_Ipp32f("Eigenvalues imaginary parts:", pDstValuesIm,
            4, 1, status);
    } else {
        printf("Function returns status: %s \n", ippGetStatusString(status));
    }
 
    return status;
}
 

The program above produces the following output:

Right Eigenvectors matrix:

0.474274  0.634963  -0.000000  0.427198

0.517958  -0.265734  0.248532  0.490144

0.382597  0.137734  0.336858  -0.734311

0.600337  -0.374312  -0.438048  -0.195057

Left Eigenvectors matrix:

0.464708  -0.418516  -0.286199  0.261720

0.481775  0.588117  -0.000000  0.578442

0.431235  0.235992  -0.272731  -0.735273

0.604960  -0.327181  0.399914  -0.237237

Eigenvalues real parts:

6.870119  0.224240  0.224240  -2.318601

Eigenvalues imaginary parts:

0.000000  1.684493  -1.684493  0.000000

Return Values

ippStsOk

Indicates no error.

ippStsNullPtrErr

Indicates an error when at least one input pointer is NULL.

ippStsSizeErr

Indicates an error when the input size parameter is less or equal to 0.

ippStsStrideMatrixErr

Indicates an error when any of the stride values is not positive or not divisible by the size of the data type.

ippStsRoiShiftMatrixErr

Indicates an error when the RoiShift value is negative or not divisible by the size of the data type.

ippStsCountMatrixErr

Indicates an error when the count value is less or equal to 0.

ippStsSingularErr

Indicates an error when any of the input matrices is singular.

ippStsConvergeErr

Indicates an error when the algorithm does not converge.

Submit feedback on this help topic

Copyright © 2000 - 2010, Intel Corporation. All rights reserved.