Gaxpy

Performs the “gaxpy” operation on a matrix.

Syntax

Case 1: Matrix - vector - vector operation

IppStatus ippmGaxpy_mv_32f(const Ipp32f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp32f* pSrc2, int src2Stride2, int src2Len, const Ipp32f* pSrc3, int src2Stride3, int src3Len, Ipp32f* pDst, int dstStride2);

IppStatus ippmGaxpy_mv_64f(const Ipp64f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp64f* pSrc2, int src2Stride2, int src2Len, const Ipp64f* pSrc3, int src3Stride2, int src3Len, Ipp64f* pDst, int dstStride2);

IppStatus ippmGaxpy_mv_32f_P(const Ipp32f** ppSrc1, int src1RoiShift, int src1Width, int src1Height, const Ipp32f** ppSrc2, int src2RoiShift, int src2Len, const Ipp32f** ppSrc3, int src3RoiShift, int src3Len, Ipp32f** ppDst, int dstRoiShift);

IppStatus ippmGaxpy_mv_64f_P(const Ipp64f** ppSrc1, int src1RoiShift, int src1Width, int src1Height, const Ipp64f** ppSrc2, int src2RoiShift, int src2Len, const Ipp64f** ppSrc3, int src3RoiShift, int src3Len, Ipp64f** ppDst, int dstRoiShift);

Case 2: Matrix - vector array - vector array operation

IppStatus ippmGaxpy_mva_32f(const Ipp32f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp32f* pSrc2, int src2Stride0, int src2Stride2, int src2Len, const Ipp32f* pSrc3, int src3Stride0, int src3Stride2, int src3Len, Ipp32f* pDst, int dstStride0, int dstStride2, int count);

IppStatus ippmGaxpy_mva_64f(const Ipp64f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp64f* pSrc2, int src2Stride0, int src2Stride2, int src2Len, const Ipp64f* pSrc3, int src3Stride0, int src3Stride2, int src3Len, Ipp64f* pDst, int dstStride0, int dstStride2, int count);

IppStatus ippmGaxpy_mva_32f_P(const Ipp32f** ppSrc1, int src1RoiShift, int src1Width, int src1Height, const Ipp32f** ppSrc2, int src2RoiShift, int src2Stride0, int src2Len, const Ipp32f** ppSrc3, int src3RoiShift, int src3Stride0, int src3Len, Ipp32f** ppDst, int dstRoiShift, int dstStride0, int count);

IppStatus ippmGaxpy_mva_64f_P(const Ipp64f** ppSrc1, int src1RoiShift, int src1Width, int src1Height, const Ipp64f** ppSrc2, int src2RoiShift, int src2Stride0, int src2Len, const Ipp64f** ppSrc3, int src3RoiShift, int src3Stride0, int src3Len, Ipp64f** ppDst, int dstRoiShift, int dstStride0, int count);

IppStatus ippmGaxpy_mva_32f_L(const Ipp32f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp32f** ppSrc2, int src2RoiShift, int src2Stride2, int src2Len, const Ipp32f** ppSrc3, int src3RoiShift, int src3Stride2, int src3Len, Ipp32f** ppDst, int dstRoiShift, int dstStride2, int count);

IppStatus ippmGaxpy_mva_64f_L(const Ipp64f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp64f** ppSrc2, int src2RoiShift, int src2Stride2, int src2Len, const Ipp64f** ppSrc3, int src3RoiShift, int src3Stride2, int src3Len, Ipp64f** ppDst, int dstRoiShift, int dstStride2, int count;)

Case 3: Matrix - vector array - vector operation

IppStatus ippmGaxpy_mvav_32f (const Ipp32f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp32f* pSrc2, int src2Stride0, int src2Stride2, int src2Len, const Ipp32f* pSrc3, int src3Stride2, int src3Len, Ipp32f* pDst, int dstStride0, int dstStride2, int count);

IppStatus ippmGaxpy_mvav_64f (const Ipp64f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp64f* pSrc2, int src2Stride0, int src2Stride2, int src2Len, const Ipp64f* pSrc3, int src3Stride2, int src3Len, Ipp64f* pDst, int dstStride0, int dstStride2, int count);

IppStatus ippmGaxpy_mvav_32f_P (const Ipp32f** ppSrc1, int src1RoiShift, int src1Width, int src1Height, const Ipp32f** ppSrc2, int src2RoiShift, int src2Stride0, int src2Len, const Ipp32f** ppSrc3, int src3RoiShift, int src3Len, Ipp32f** ppDst, int dstRoiShift, int dstStride0, int count);

IppStatus ippmGaxpy_mvav_64f_P (const Ipp64f** ppSrc1, int src1RoiShift, int src1Width, int src1Height, const Ipp64f** ppSrc2, int src2RoiShift, int src2Stride0, int src2Len, const Ipp64f** ppSrc3, int src3RoiShift, int src3Len, Ipp64f** ppDst, int dstRoiShift, int dstStride0, int count);

IppStatus ippmGaxpy_mvav_32f_L (const Ipp32f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp32f** ppSrc2, int src2RoiShift, int src2Stride2, int src2Len, const Ipp32f* pSrc3, int src3Stride2, int src3Len, Ipp32f** ppDst, int dstRoiShift, int dstStride2, int count);

IppStatus ippmGaxpy_mvav_64f_L (const Ipp64f* pSrc1, int src1Stride1, int src1Stride2, int src1Width, int src1Height, const Ipp64f** ppSrc2, int src2RoiShift, int src2Stride2, int src2Len, const Ipp64f* pSrc3, int src3Stride2, int src3Len, Ipp64f** ppDst, int dstRoiShift, int dstStride2, int count);

Parameters

pSrc1, ppSrc1

Pointer to the source matrix or array of matrices.

src1Stride0

Stride between the matrices in the source matrix array.

src1Stride1

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

src1Stride2

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

src1RoiShift

ROI shift in the source matrix(ces).

src1Width

Matrix width.

src1Height

Matrix height.

pSrc2, ppSrc2

Pointer to the first source vector or array of vectors.

src2Stride0

Stride between the vectors in the first source vector array.

src2Stride2

Stride between the elements in the first source vector(s).

src2RoiShift

ROI shift in the first source vector(s).

src2Len

Length of the first source vector(s).

pSrc3, ppSrc3

Pointer to the second source vector or array of vectors.

src3Stride0

Stride between the vectors in the second source vector array.

src3Stride2

Stride between the elements in the second source vector(s).

src3RoiShift

ROI shift in the second source vector(s).

src3Len

Length of the second source vector(s).

pDst, ppDst

Pointer to the destination vector or array of vectors.

dstStride0

Stride between the vectors in the destination array.

dstStride2

Stride between the elements in the destination vector(s).

dstRoiShift

ROI shift in the destination vector(s).

count

Number of objects in the array.

Description

The function ippmGaxpy is declared in the ippm.h header file. The function performs the “gaxpy” operation on a matrix by

The function iterates consequently through all the rows of the matrices in question.

To clarify how the function operates on arrays of vectors, see Operations with arrays of objects.

Note that the number of elements in the second source vector src2Len must be equal to src1Width and the number of elements in the third source vector src3Len must be equal to src1Height.

For the Gaxpy function, having three source operands src1, src2, and src3, by default, the type of the object src3 is not specified in the function name if src2 and src3 objects are of the same type. The function name contains specifications of all the three object types if src2 and src3 have different types.

For example,

ippmGaxpy_mv, default, both src2 and src3 operands are vectors (type v).

ippmGaxpy_mva, default, both src2 and src3 operands are vector arrays (type va).

ippmGaxpy_mvav, the operand src2 is a vector array (type va) and src3 is a vector (type v).

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

ippmGaxpy_mva_32f  

IppStatus gaxpy_mva_32f(void) {
    /* Src1 matrix with width=3, height=4, Stride2=2*sizeof(Ipp32f) */
    Ipp32f pSrc1[4*6] = { 1, 0, 2, 0, 3, 0,
                          4, 0, 5, 0, 6, 0,
                          7, 0, 8, 0, 9, 0,
                          2, 0, 4, 0, 6, 0 };
    /* Src2 data: 2 vectors with length=3, Stride2=sizeof(Ipp32f) */
    Ipp32f pSrc2[2*3] = { 1, 6, 3,
                          4, 5, 2 };

    /* Src3 data: 2 vectors with length=4, Stride2=sizeof(Ipp32f) */
    Ipp32f pSrc3[2*4] = { -11, -16, -13, -17,
                           -4, -15, -12, -18 };
    /* Standard description for Src1 */
    int src1Width   = 3;
    int src1Height  = 4;
    int src1Stride2 = 2 * sizeof(Ipp32f);
    int src1Stride1 = 6 * sizeof(Ipp32f);

    /* Standard description for Src2 */
    int src2Length = 3;
    int src2Stride2  = sizeof(Ipp32f);
    int src2Stride0  = 3*sizeof(Ipp32f);

    /* Standard description for Src3 */
    int src3Length = 4;
    int src3Stride2  = sizeof(Ipp32f);
    int src3Stride0  = 4*sizeof(Ipp32f);

    /*
    // Destination vector has length=src1Height=src3Length=4 
    // Standard description for Dst:
    */
    Ipp32f pDst[2*4];
    int dstStride2  = sizeof(Ipp32f);
    int dstStride0  = 4*sizeof(Ipp32f);

    int count  = 2;
 
    IppStatus status = ippmGaxpy_mva_32f((const Ipp32f*)pSrc1,
        src1Stride1, src1Stride2, src1Width, src1Height,
        (const Ipp32f*)pSrc2, src2Stride0, src2Stride2, src2Length,
        (const Ipp32f*)pSrc3, src3Stride0, src3Stride2, src3Length,
        pDst, dstStride0, dstStride2, count);

    /*
    // It is recommended to check return status 
    // to detect wrong input parameters, if any  
    */
    if(status == ippStsNoErr){
        printf_va_Ipp32f("2 destination vectors:", pDst, 4, 2, status);
    } else {
        printf("Function returns status: %s \n", ippGetStatusString(status));
    } 
    return status;
}
 

The program above produces the following output:

2 destination vectors:

11.000000  36.000000  69.000000  27.000000

16.000000  38.000000  74.000000  22.000000

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

ippmGaxpy_mvav_32f_L  

IppStatus gaxpy_mvav_32f_L(void) {
    /* Src1 data: matrix with width=3, height=4, Stride2=2*sizeof(Ipp32f) */
    Ipp32f pSrc1[4*6] = { 1, 0, 2, 0, 3, 0,
                          4, 0, 5, 0, 6, 0,
                          7, 0, 8, 0, 9, 0,
                          2, 0, 4, 0, 6, 0 };

    /* 
    // Src2 data: 2 vectors with length=3, Stride2=sizeof(Ipp32f) 
    // Vectors are spaced in the memory irregularly    
    */
    Ipp32f src2_a[3] = { 1, 6, 3 };
    Ipp32f src2_b[3] = { 4, 5, 2 };

    /* Src3 data: 1 vectors with length=4, Stride2=sizeof(Ipp32f) */
    Ipp32f pSrc3[4] = { -11, -16, -13, -17 };

    /* Standard description for Src1 */
    int src1Width   = 3;
    int src1Height  = 4;
    int src1Stride2 = 2 * sizeof(Ipp32f);
    int src1Stride1 = 6 * sizeof(Ipp32f);

    /* Layout description for Src2 */
    Ipp32f* ppSrc2[2] = { src2_a, src2_b };
    int src2Length = 3;
    int src2Stride2  = sizeof(Ipp32f);
    int src2RoiShift = 0;

    /* Standard description for Src3 */
    int src3Length = 4;
    int src3Stride2  = sizeof(Ipp32f);
    
    /* 
    // Layout description for Dst:
    // Destination vector has length=src1Height=src3Length=4 
    */
    Ipp32f dst[2*4];
    Ipp32f* ppDst[2] = { dst, dst+4};

    int dstStride2  = sizeof(Ipp32f);
    int dstRoiShift = 0;

    int count  = 2;
    
    IppStatus status = ippmGaxpy_mvav_32f_L ((const Ipp32f*)pSrc1, 
        src1Stride1, src1Stride2, src1Width, src1Height, 
        (const Ipp32f**)ppSrc2, src2RoiShift, src2Stride2, src2Length, 
        (const Ipp32f*)pSrc3, src3Stride2, src3Length,  
        ppDst, dstRoiShift, dstStride2, count);
    
    /*
    // It is kindly recommended to check return status 
    // to avoid wrong input parameters  
    */
    if(status == ippStsOk){
        printf_va_Ipp32f("2 destination vectors:", dst, 4, 2, status);
    } else {
        printf("Function returns status: %s \n",
            ippGetStatusString(status));
    } 
    return status;
}
 

The program above produces the following output:

2 destination vectors:

11.000000  36.000000  69.000000  27.000000

16.000000  38.000000  74.000000  22.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.

ippStsStrideMatrixErr

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

ippStsRoiShiftMatrixErr

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

ippStsCountMatrixErr

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

ippStsSizeMatchMatrixErr

Returns an error when the sizes of the source matrices are unsuitable.

Submit feedback on this help topic

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