Invert

Computes matrix inverse.

Syntax

Case 1: Matrix operation

IppStatus ippmInvert_m_32f(const Ipp32f* pSrc, int srcStride1, int srcStride2, Ipp32f* pBuffer, Ipp32f* pDst, int dstStride1, int dstStride2, int widthHeight);

IppStatus ippmInvert_m_64f(const Ipp64f* pSrc, int srcStride1, int srcStride2, Ipp64f* pBuffer, Ipp64f* pDst, int dstStride1, int dstStride2, int widthHeight);

IppStatus ippmInvert_m_32f_P(const Ipp32f** ppSrc, int srcRoiShift, Ipp32f* pBuffer, Ipp32f** ppDst, int dstRoiShift, int widthHeight);

IppStatus ippmInvert_m_64f_P(const Ipp64f** ppSrc, int srcRoiShift, Ipp64f* pBuffer, Ipp64f** ppDst, int dstRoiShift, int widthHeight);

Case 2: Matrix array operation

IppStatus ippmInvert_ma_32f(const Ipp32f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp32f* pBuffer, Ipp32f* pDst, int dstStride0, int dstStride1, int dstStride2, int widthHeight, int count);

IppStatus ippmInvert_ma_64f(const Ipp64f* pSrc, int srcStride0, int srcStride1, int srcStride2, Ipp64f* pBuffer, Ipp64f* pDst, int dstStride0, int dstStride1, int dstStride2, int widthHeight, int count);

IppStatus ippmInvert_ma_32f_P(const Ipp32f** ppSrc, int srcRoiShift, int srcStride0, Ipp32f* pBuffer, Ipp32f** ppDst, int dstRoiShift, int dstStride0, int widthHeight, int count);

IppStatus ippmInvert_ma_64f_P(const Ipp64f** ppSrc, int srcRoiShift, int srcStride0, Ipp64f* pBuffer, Ipp64f** ppDst, int dstRoiShift, int dstStride0, int widthHeight, int count);

IppStatus ippmInvert_ma_32f_L(const Ipp32f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp32f* pBuffer, Ipp32f** ppDst, int dstRoiShift, int dstStride1, int dstStride2, int widthHeight, int count);

IppStatus ippmInvert_ma_64f_L(const Ipp64f** ppSrc, int srcRoiShift, int srcStride1, int srcStride2, Ipp64f* pBuffer, Ipp64f** ppDst, int dstRoiShift, int dstStride1, int dstStride2, int widthHeight, int count);

Parameters

pSrc, ppSrc

Pointer to the source matrix or array of matrices.

srcStride0

Stride between the matrices in the source array.

srcStride1

Stride between the rows in the source matrix(ces).

srcStride2

Stride between the elements in the source matrix(ces).

srcRoiShift

ROI shift in the source matrix(ces).

pDst, ppDst

Pointer to the destination matrix or array of matrices.

dstStride0

Stride between the matrices in the destination array.

dstStride1

Stride between the rows in the destination matrix.

dstStride2

Stride between the elements in the destination matrix.

dstRoiShift

ROI shift in the destination matrix.

widthHeight

Size of the square matrix.

pBuffer

Pointer to a pre-allocated buffer to be used for internal computations. Size of the buffer must be at least widthHeight2 +widthHeight.

count

Number of matrices in the array.

Description

The function ippmInvert is declared in the ippm.h header file. The function finds the inverse of the source matrix and stores the result in pDst or ppDst. Upon completion,

dst = src-1.

The following example demonstrates how to use the function ippmInvert_m_32f. All parameter settings and descriptor types are similar to those used in ippmTranspose. Refer to examples in the description of this function for details. For more information, see also examples in Getting Started.

ippmInvert_m_32f  

IppStatus invert_m_32f(void) {
   /* Source matrix with widthHeight=3 */
    Ipp32f pSrc[3*3] = { 1,  1, -1,
                        -1,  0,  2,
                        -1, -1,  2 };
    /*
    // Standard description for source and destination matrices 
    */
    int widthHeight = 3;
    int srcStride2 = sizeof(Ipp32f);
    int srcStride1 = 3*sizeof(Ipp32f);

    Ipp32f pDst[3*3];
    int dstStride2 = sizeof(Ipp32f);
    int dstStride1 = 3*sizeof(Ipp32f);

    Ipp32f pBuffer[3*3+3]; /* Buffer location */

    IppStatus status = ippmInvert_m_32f((const Ipp32f*)pSrc, srcStride1,
        srcStride2, pBuffer, pDst, dstStride1, dstStride2, 3);

    /*
    // It is required for Invert function to check return status 
    // for catching wrong result in case of invalid input data 
    */
    if (status == ippStsNoErr) {
        printf_m_Ipp32f("Inverted matrix:", pDst, 3, 3, status);
    } else {
        printf("Function returns status: %s \n", ippGetStatusString(status));
    } 
    return status;

}
 

The program above produces the following output:

Inverted matrix:

2.000000  -1.000000  2.000000

0.000000  1.000000  -1.000000

1.000000  0.000000  1.000000

Return Values

ippStsOk

Returns no error.

ippStsNullPtrErr

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

ippStsSizeErr

Returns an error when the input size parameter is equal to 0.

ippStsSingularErr

Returns an error when the source matrix is singular.

ippStsStrideMatrixErr

Returns an error when the stride value is not positive or not divisible by the size of the data type.

ippStsRoiShiftMatrixErr

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

ippStsCountMatrixErr

Returns an error when the count value is less or equal to zero.

Submit feedback on this help topic

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