GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
volk_32f_sqrt_32f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32f_sqrt_32f_a_H
2 #define INCLUDED_volk_32f_sqrt_32f_a_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 #include <math.h>
7 
8 #ifdef LV_HAVE_SSE
9 #include <xmmintrin.h>
10 /*!
11  \brief Sqrts the two input vectors and store their results in the third vector
12  \param cVector The vector where the results will be stored
13  \param aVector One of the vectors to be sqrted
14  \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
15 */
16 static inline void volk_32f_sqrt_32f_a_sse(float* cVector, const float* aVector, unsigned int num_points){
17  unsigned int number = 0;
18  const unsigned int quarterPoints = num_points / 4;
19 
20  float* cPtr = cVector;
21  const float* aPtr = aVector;
22 
23  __m128 aVal, cVal;
24  for(;number < quarterPoints; number++){
25 
26  aVal = _mm_load_ps(aPtr);
27 
28  cVal = _mm_sqrt_ps(aVal);
29 
30  _mm_store_ps(cPtr,cVal); // Store the results back into the C container
31 
32  aPtr += 4;
33  cPtr += 4;
34  }
35 
36  number = quarterPoints * 4;
37  for(;number < num_points; number++){
38  *cPtr++ = sqrtf(*aPtr++);
39  }
40 }
41 #endif /* LV_HAVE_SSE */
42 
43 #ifdef LV_HAVE_GENERIC
44 /*!
45  \brief Sqrts the two input vectors and store their results in the third vector
46  \param cVector The vector where the results will be stored
47  \param aVector One of the vectors to be sqrted
48  \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
49 */
50 static inline void volk_32f_sqrt_32f_generic(float* cVector, const float* aVector, unsigned int num_points){
51  float* cPtr = cVector;
52  const float* aPtr = aVector;
53  unsigned int number = 0;
54 
55  for(number = 0; number < num_points; number++){
56  *cPtr++ = sqrtf(*aPtr++);
57  }
58 }
59 #endif /* LV_HAVE_GENERIC */
60 
61 #ifdef LV_HAVE_ORC
62 extern void volk_32f_sqrt_32f_a_orc_impl(float *, const float*, unsigned int);
63 /*!
64  \brief Sqrts the two input vectors and store their results in the third vector
65  \param cVector The vector where the results will be stored
66  \param aVector One of the vectors to be sqrted
67  \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
68 */
69 static inline void volk_32f_sqrt_32f_u_orc(float* cVector, const float* aVector, unsigned int num_points){
70  volk_32f_sqrt_32f_a_orc_impl(cVector, aVector, num_points);
71 }
72 
73 #endif /* LV_HAVE_ORC */
74 
75 
76 
77 #endif /* INCLUDED_volk_32f_sqrt_32f_a_H */