Vector Optimized Library of Kernels  3.2.0
Architecture-tuned implementations of math kernels
volk_32fc_s32f_power_32fc.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2012, 2014 Free Software Foundation, Inc.
4  *
5  * This file is part of VOLK
6  *
7  * SPDX-License-Identifier: LGPL-3.0-or-later
8  */
9 
42 #ifndef INCLUDED_volk_32fc_s32f_power_32fc_a_H
43 #define INCLUDED_volk_32fc_s32f_power_32fc_a_H
44 
45 #include <inttypes.h>
46 #include <math.h>
47 #include <stdio.h>
48 
51  const float power)
52 {
53  const float arg = power * atan2f(lv_creal(exp), lv_cimag(exp));
54  const float mag =
55  powf(lv_creal(exp) * lv_creal(exp) + lv_cimag(exp) * lv_cimag(exp), power / 2);
56  return mag * lv_cmake(-cosf(arg), sinf(arg));
57 }
58 
59 #ifdef LV_HAVE_GENERIC
60 
61 static inline void volk_32fc_s32f_power_32fc_generic(lv_32fc_t* cVector,
62  const lv_32fc_t* aVector,
63  const float power,
64  unsigned int num_points)
65 {
66  lv_32fc_t* cPtr = cVector;
67  const lv_32fc_t* aPtr = aVector;
68  unsigned int number = 0;
69 
70  for (number = 0; number < num_points; number++) {
71  *cPtr++ = __volk_s32fc_s32f_power_s32fc_a((*aPtr++), power);
72  }
73 }
74 
75 #endif /* LV_HAVE_GENERIC */
76 
77 
78 #endif /* INCLUDED_volk_32fc_s32f_power_32fc_a_H */
static void volk_32fc_s32f_power_32fc_generic(lv_32fc_t *cVector, const lv_32fc_t *aVector, const float power, unsigned int num_points)
Definition: volk_32fc_s32f_power_32fc.h:61
static lv_32fc_t __volk_s32fc_s32f_power_s32fc_a(const lv_32fc_t exp, const float power)
raise a complex float to a real float power
Definition: volk_32fc_s32f_power_32fc.h:50
#define lv_cimag(x)
Definition: volk_complex.h:98
#define lv_cmake(r, i)
Definition: volk_complex.h:77
#define lv_creal(x)
Definition: volk_complex.h:96
float complex lv_32fc_t
Definition: volk_complex.h:74