Rate This Document
Findability
Accuracy
Completeness
Readability

cvconj

Calculate the conjugate of complex vectors.

The function interface declaration is as follows:

Operations on numbers of the float type:

void (vsip_cvconj_f)(const vsip_cvview_f *a, const vsip_cvview_f *r);

Parameters

Parameter

Description

Value Range

Input/Output

a

Pointer to the source complex vector

The value cannot be NULL.

Input

r

Pointer to the destination complex vector

The value cannot be NULL.

Output

Abnormal Input

When a null pointer is input, the function directly returns a result.

Example

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "kvsip.h"
#include "vsip.h"
#include "vsip_type.h"

#define BUFFER_SIZE_T 10
void CvconjExample()
{
    float src[BUFFER_SIZE_T] = {1.64f, 1.63f, -1.09f, 0.71f, -3.20f, -0.43f, 0.41f, -4.83f, 5.36f, -4.40f};
    float dst[BUFFER_SIZE_T];
    int64_t stride = 1;
    int64_t cvLen = BUFFER_SIZE_T / 2;
    uint64_t offset = 0;

    vsip_cblock_f *block_a = vsip_cblockbind_f(src, NULL, cvLen, VSIP_MEM_NONE);
    vsip_cblock_f *block_r = vsip_cblockbind_f(dst, NULL, cvLen, VSIP_MEM_NONE);

    vsip_cvview_f *a = vsip_cvbind_f(block_a, offset, stride, cvLen);
    vsip_cblockadmit_f(block_a, VSIP_TRUE);
    vsip_cvview_f *r = vsip_cvbind_f(block_r, offset, stride, cvLen);
    vsip_cblockadmit_f(block_r, VSIP_TRUE);

    vsip_cvconj_f(a, r);

    vsip_cvalldestroy_f(a);
    vsip_cvalldestroy_f(r);

    printf("src:\n");
    for (int32_t i = 0; i < cvLen; ++i) {
        printf("%.2f ", src[i * 2]);
        printf("%.2f    ", src[i * 2 + 1]);
    }
    printf("\ndst:\n");
    for (int32_t i = 0; i < cvLen; ++i) {
        printf("%.2f ", dst[i * 2]);
        printf("%.2f    ", dst[i * 2 + 1]);
    }
    printf("\n");
}

int main(void) {
    CvconjExample();
    return 0;
}

Output:

src:
1.64 1.63    -1.09 0.71    -3.20 -0.43    0.41 -4.83    5.36 -4.40
dst:
1.64 -1.63    -1.09 -0.71    -3.20 0.43    0.41 4.83    5.36 4.40