我要评分
获取效率
正确性
完整性
易理解

cmplx

Generate complex scalars.

The function interface declaration is as follows:

Operations on numbers of the float type:

vsip_cscalar_f vsip_cmplx_f(float r, float i);

Parameters

Parameter

Description

Value Range

Input/Output

r

Generate the real part of a complex number.

Unlimited

Input

i

Generate the imaginary part of a complex number.

Unlimited

Output

Example

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

void CmplxExample()
{
    float r = 1.1f;
    float i = -1.2f;
    vsip_cscalar_f dst = vsip_cmplx_f(r, i);

    printf("alpha: %.2f %.2f\n", r, i);
    printf("dst: %.2f %.2f\n", dst.r, dst.i);
}

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

Output:

alpha: 1.10 -1.20
dst: 1.10 -1.20