vcmaxmgsqval
Calculate the maximum modular square of complex vectors and perform index operations.
The function interface declaration is as follows:
Operations on numbers of the float type:
float (vsip_vcmaxmgsqval_f)(const vsip_cvview_f *a, uint64_t *j);
Parameters
Parameter |
Description |
Value Range |
Input/Output |
|---|---|---|---|
a |
Pointer to the source complex vector |
The value cannot be NULL. |
Input |
j |
Pointer to the index variable |
The value cannot be NULL. |
Output |
Abnormal Input
When a null pointer is input, the function directly returns a NaN value.
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 VcmaxmgsqvalExample()
{
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};
int64_t stride = 1;
int64_t cvLen = BUFFER_SIZE_T / 2;
uint64_t offset = 0;
uint64_t j = 0;
vsip_cblock_f *block_a = vsip_cblockbind_f(src, NULL, cvLen, VSIP_MEM_NONE);
vsip_cvview_f *a = vsip_cvbind_f(block_a, offset, stride, cvLen);
vsip_cblockadmit_f(block_a, VSIP_TRUE);
float dst = vsip_vcmaxmgsqval_f(a, &j);
vsip_cvalldestroy_f(a);
printf("src:\n");
for (int32_t i = 0; i < cvLen; ++i) {
printf("%.4f ", src[i * 2]);
printf("%.4f ", src[i * 2 + 1]);
}
printf("\nindex: %lu, dst: %.4f\n", j, dst);
}
int main(void) {
VcmaxmgsqvalExample();
return 0;
}
Output:
src: 1.6400 1.6300 -1.0900 0.7100 -3.2000 -0.4300 0.4100 -4.8300 5.3600 -4.4000 index: 4, dst: 48.0896
Parent topic: Vector Operation Functions