veuler
Perform operations on real-number vectors using the Euler formula.
The function interface declaration is as follows:
Operations on numbers of the float type:
void (vsip_veuler_f)(const vsip_vview_f *a, const vsip_cvview_f *r);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
a |
Pointer to the source 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 VeulerExample()
{
float src[BUFFER_SIZE_T / 2] = {1.64f, 1.63f, -1.09f, 0.71f, -3.20f};
float dst[BUFFER_SIZE_T];
int64_t cvLen = BUFFER_SIZE_T / 2;
int64_t stride = 1;
uint64_t offset = 0;
vsip_block_f *block_a = vsip_blockbind_f(src, cvLen, VSIP_MEM_NONE);
vsip_cblock_f *block_r = vsip_cblockbind_f(dst, NULL, cvLen, VSIP_MEM_NONE);
vsip_vview_f *a = vsip_vbind_f(block_a, offset, stride, BUFFER_SIZE_T);
vsip_blockadmit_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_veuler_f(a, r);
vsip_valldestroy_f(a);
vsip_cvalldestroy_f(r);
printf("src:\n");
for (int32_t i = 0; i < cvLen; ++i) {
printf("%.2f ", src[i]);
}
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) {
VeulerExample();
return 0;
}
Output:
src: 1.64 1.63 -1.09 0.71 -3.20 dst: -0.07 1.00 -0.06 1.00 0.46 -0.89 0.76 0.65 -1.00 0.06
Parent topic: Vector Operation Functions