GNU Radio 3.6.5 C++ API

volk_32f_sqrt_32f_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_32f_sqrt_32f_a_H
00002 #define INCLUDED_volk_32f_sqrt_32f_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 #include <math.h>
00007 
00008 #ifdef LV_HAVE_SSE
00009 #include <xmmintrin.h>
00010 /*!
00011   \brief Sqrts the two input vectors and store their results in the third vector
00012   \param cVector The vector where the results will be stored
00013   \param aVector One of the vectors to be sqrted
00014   \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
00015 */
00016 static inline void volk_32f_sqrt_32f_a_sse(float* cVector, const float* aVector, unsigned int num_points){
00017     unsigned int number = 0;
00018     const unsigned int quarterPoints = num_points / 4;
00019 
00020     float* cPtr = cVector;
00021     const float* aPtr = aVector;
00022 
00023     __m128 aVal, cVal;
00024     for(;number < quarterPoints; number++){
00025 
00026       aVal = _mm_load_ps(aPtr);
00027 
00028       cVal = _mm_sqrt_ps(aVal);
00029 
00030       _mm_store_ps(cPtr,cVal); // Store the results back into the C container
00031 
00032       aPtr += 4;
00033       cPtr += 4;
00034     }
00035 
00036     number = quarterPoints * 4;
00037     for(;number < num_points; number++){
00038       *cPtr++ = sqrtf(*aPtr++);
00039     }
00040 }
00041 #endif /* LV_HAVE_SSE */
00042 
00043 #ifdef LV_HAVE_GENERIC
00044 /*!
00045   \brief Sqrts the two input vectors and store their results in the third vector
00046   \param cVector The vector where the results will be stored
00047   \param aVector One of the vectors to be sqrted
00048   \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
00049 */
00050 static inline void volk_32f_sqrt_32f_a_generic(float* cVector, const float* aVector, unsigned int num_points){
00051     float* cPtr = cVector;
00052     const float* aPtr = aVector;
00053     unsigned int number = 0;
00054 
00055     for(number = 0; number < num_points; number++){
00056       *cPtr++ = sqrtf(*aPtr++);
00057     }
00058 }
00059 #endif /* LV_HAVE_GENERIC */
00060 
00061 #ifdef LV_HAVE_ORC
00062 extern void volk_32f_sqrt_32f_a_orc_impl(float *, const float*, unsigned int);
00063 /*!
00064   \brief Sqrts the two input vectors and store their results in the third vector
00065   \param cVector The vector where the results will be stored
00066   \param aVector One of the vectors to be sqrted
00067   \param num_points The number of values in aVector and bVector to be sqrted together and stored into cVector
00068 */
00069 static inline void volk_32f_sqrt_32f_a_orc(float* cVector, const float* aVector, unsigned int num_points){
00070     volk_32f_sqrt_32f_a_orc_impl(cVector, aVector, num_points);
00071 }
00072 
00073 #endif /* LV_HAVE_ORC */
00074 
00075 
00076 
00077 #endif /* INCLUDED_volk_32f_sqrt_32f_a_H */