EigenValuesVectorsSym

Finds eigenvalues and eigenvectors for real symmetric matrices (solves symmetric eigenvalue problem).

Syntax

Case 1: Matrix operation

IppStatus ippmEigenValuesVectorsSym_m_32f (const Ipp32f* pSrc, int srcStride1, int srcStride2, Ipp32f* pBuffer, Ipp32f* pDstVectors, int dstStride1, int dstStride2, Ipp32f* pDstValues, int widthHeight);

IppStatus ippmEigenValuesVectorsSym_m_64f (const Ipp64f* pSrc, int srcStride1, int srcStride2, Ipp64f* pBuffer, Ipp64f* pDstVectors, int dstStride1, int dstStride2, Ipp64f* pDstValues, int widthHeight);

IppStatus ippmEigenValuesVectorsSym_m_32f_P (const Ipp32f** ppSrc, int srcRoiShift, Ipp32f* pBuffer, Ipp32f** ppDstVectors, int dstRoiShift, Ipp32f* pDstValues, int widthHeight);

IppStatus ippmEigenValuesVectorsSym_m_64f_P (const Ipp64f** ppSrc, int srcRoiShift, Ipp64f* pBuffer, Ipp64f** ppDstVectors, int dstRoiShift, Ipp64f* pDstValues, int widthHeight);

Case 2: Matrix array operation

IppStatus ippmEigenValuesVectorsSym_ma_32f (const Ipp32f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp32f* pBuffer, Ipp32f* pDstVectors, int dstStride0, int dstStride1, int dstStride2, Ipp32f* pDstValues, int widthHeight, int count);

IppStatus ippmEigenValuesVectorsSym_ma_32f_P (const Ipp32f** ppSrc, int srcRoiShift, int srcStride0, Ipp32f* pBuffer, Ipp32f** ppDstVectors, int dstRoiShift, int dstStride0, Ipp32f* pDstValues, int widthHeight, int count);

IppStatus ippmEigenValuesVectorsSym_ma_32f_L (const Ipp32f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp32f* pBuffer, Ipp32f** ppDstVectors, int dstRoiShift, int dstStride1, int dstStride2, Ipp32f* pDstValues, int widthHeight, int count);

IppStatus ippmEigenValuesVectorsSym_ma_64f (const Ipp64f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp64f* pBuffer, Ipp64f* pDstVectors, int dstStride0, int dstStride1, int dstStride2, Ipp64f* pDstValues, int widthHeight, int count);

IppStatus ippmEigenValuesVectorsSym_ma_64f_P (const Ipp64f** ppSrc, int srcRoiShift, int srcStride0, Ipp64f* pBuffer, Ipp64f** ppDstVectors, int dstRoiShift, int dstStride0, Ipp64f* pDstValues, int widthHeight, int count);

IppStatus ippmEigenValuesVectorsSym_ma_64f_L (const Ipp64f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp64f* pBuffer, Ipp64f** ppDstVectors, int dstRoiShift, int dstStride1, int dstStride2, Ipp64f* pDstValues, int widthHeight, int count);

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).

pBuffer

Pointer to a pre-allocated auxiliary array to be used for internal computations. The number of elements in the array must be at least widthHeight2 .

pDstVectors, ppDstVectors

Pointer to the destination matrix or array of matrices whose columns are eigenvectors.

dstStride0

Stride between matrices in the destination array.

dstStride1

Stride between rows in the destination matrix.

dstStride2

Stride between elements in the destination matrix.

dstRoiShift

ROI shift in the destination matrix.

pDstValues

Pointer to the destination dense array that contains eigenvalues. The number of elementes in the array must be at least widthHeight for a matrix and widthHeight*count for an array of matrices.

widthHeight

Size of the square matrix.

count

The number of matrices in the array.

Description

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

The function solves the Symmetric Eigenvalue Problem, that is finds the eigenvalues λ and corresponding eigenvectors z0 such that

Az=λz ,

where A is a real symmetric square matrix of size widthHeight.

In case of a real symmetric matrix, all the widthHeight eigenvalues are real and there exists an orthonormal system of widthHeight eigenvectors. When all eigenvalues and eigenvectors are computed, the classical spectral factorization of A is

A =ZΛZT ,

where Λ is a diagonal matrix whose non-zero elements are the eigenvalues, Z is an orthogonal matrix whose columns are the eigenvectors, and ZT is its transpose.

The function stores eigenvalues in the array pointed by pDstValues densely and in the decreasing order. Eigenvectors of a source matrix are placed in columns of the appropriate destination matrix, pointed by pDstVectors or ppDstVectors.

The function uses only data in the lower triangular part of a source matrix *pSrc or *ppSrc.

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

ippmEigenValuesVectorsSym_m_32f

IppStatus eigen_problem_32fvoid){
    /* Source matrix with width=4 and height=4 */
    Ipp32f pSrc[4*4]= {1, 1, 1, 3, 
                       1, 3, 1, 3, 
                       1, 1, 3, 1, 
                       3, 3, 1, 3};
    int srcStride2 = sizeof(Ipp32f); 
    int srcStride1 = 4*sizeof(Ipp32f);

    Ipp32f pBuffer[4*4]; /* Buffer location */
    int widthHeight = 4; Ipp32f pDstValues[4]; /* Eigenvalues location */

    Ipp32f pDstVectors[4*4]; /* Eigenvectors location */
 

    int dstStride2 = sizeof(Ipp32f); int dstStride1 = 4*sizeof(Ipp32f);
    IppStatus status=ippmEigenValuesVectorsSym_m_32f((const Ipp32f*)pSrc, 
    srcStride1, srcStride2, pBuffer, 
    pDstVectors, dstStride1, dstStride2, pDstValues, widthHeight);


    /*
    // It is required for EigenValuesVectors function to check return status
    // for catching wrong result in case of invalid input data
    */
    if (status == ippStsNoErr) {
       printf_va_Ipp32f("Eigenvalues:", pDstValues, 4, 1, status);
       printf_m_Ipp32f("Eigenvectors :", pDstVectors, 4, 4, status);
    } else {
     printf("Function returns status: %s \n", ippGetStatusString(status));
    }

   return status; 
}

The program above produces the following output:

Eigenvalues:

7.911653  2.443112  1.121464  -1.476230

Eigenvectors:

-0.409522  -0.040703  -0.587074  -0.697122

-0.548069  -0.224421  0.749409   -0.296043

-0.327626  0.938908   0.071989   0.077017

-0.651593  -0.257742  -0.297569  0.648420

Return Values

ippStsOk

Indicates no errors.

ippStsNullPtrErr

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

ippStsSizeErr

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

ippStsStrideMatrixErr

Indicates an error if a stride value is not positive or not divisible by the size of data type.

ippStsRoiShiftMatrixErr

Indicates an error if a roiShift value is negative or not divisible by the size of data type.

ippStsCountMatrixErr

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

ippStsSingularErr

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

ippStsConvergeErr

Indicates an error if the algorithm does not converge.


Submit feedback on this help topic

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